gpt4 book ai didi

php - 无法让我的 mysql_query() 在我的 php 脚本中工作

转载 作者:行者123 更新时间:2023-11-29 05:30:04 25 4
gpt4 key购买 nike

<分区>

我无法通过我的 LAMP 服务器中的 php 运行我的 php 脚本。这是我遇到问题的代码。

# Insert Statement
$insert ="INSERT INTO ACRC VALUES('','','1C3-4A','$fs','$acrc1c3_4afs');
INSERT INTO ACRC VALUES('','','1C3-4A','$fi','$acrc1c3_4afi');
INSERT INTO ACRC VALUES('','','1C3-4A','$fo','$acrc1c3_4afo');
INSERT INTO ACRC VALUES('','','1C3-4B','$fs','$acrc1c3_4bfs');
INSERT INTO ACRC VALUES('','','1C3-4B','$fi','$acrc1c3_4bfi');
INSERT INTO ACRC VALUES('','','1C3-4B','$fo','$acrc1c3_4bfo');
INSERT INTO ACRC VALUES('','','1C3-12A','$fs','$acrc1c3_12afs');
INSERT INTO ACRC VALUES('','','1C3-12A','$fi','$acrc1c3_12afi');
INSERT INTO ACRC VALUES('','','1C3-12A','$fo','$acrc1c3_12afo');
INSERT INTO ACRC VALUES('','','1C3-12B','$fs','$acrc1c3_12bfs');
INSERT INTO ACRC VALUES('','','1C3-12B','$fi','$acrc1c3_12bfi');
INSERT INTO ACRC VALUES('','','1C3-12B','$fo','$acrc1c3_12bfo');";
echo "$insert";
mysql_query($insert) or die(mysql_error());
echo "$insert";
?>

运行此命令将返回以下结果。

[root@enseva html]# php snmp.php
ACRC Unit 1C3-4A : Fan Speed 73.3 % : Fluid In Temperature 47.2 F : Fluid Out Temperature 55 F
ACRC Unit 1C3-4B : Fan Speed 74 % : Fluid In Temperature 47.8 F : Fluid Out Temperature 53.5 F
ACRC Unit 1C3-12A : Fan Speed 28.9 % : Fluid In Temperature 44.7 F : Fluid Out Temperature 46.4 F
ACRC Unit 1C3-12B : Fan Speed 28.5 % : Fluid In Temperature 47.1 F : Fluid Out Temperature 62.9 F
INSERT INTO ACRC VALUES('','','1C3-4A','Fan Speed','73.3');
INSERT INTO ACRC VALUES('','','1C3-4A','Fluid Temperature In','47.2');
INSERT INTO ACRC VALUES('','','1C3-4A','Fluid Temperature Out','55');
INSERT INTO ACRC VALUES('','','1C3-4B','Fan Speed','74');
INSERT INTO ACRC VALUES('','','1C3-4B','Fluid Temperature In','47.8');
INSERT INTO ACRC VALUES('','','1C3-4B','Fluid Temperature Out','53.5');
INSERT INTO ACRC VALUES('','','1C3-12A','Fan Speed','28.9');
INSERT INTO ACRC VALUES('','','1C3-12A','Fluid Temperature In','44.7');
INSERT INTO ACRC VALUES('','','1C3-12A','Fluid Temperature Out','46.4');
INSERT INTO ACRC VALUES('','','1C3-12B','Fan Speed','28.5');
INSERT INTO ACRC VALUES('','','1C3-12B','Fluid Temperature In','47.1');
INSERT INTO ACRC VALUES('','','1C3-12B','Fluid Temperature Out','62.9');You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INSERT INTO ACRC VALUES('','','1C3-4A','Fluid Temperature In','47.2');INSERT IN' at line 2

现在我从中获取结果并手动将其放入我的 mysql 中并且它按原样工作,尽管它确实在每个插入语句中返回 2 个警告。第一个值是一个自动递增的 id 值,第二个是一个时间戳。

对于后续问题,我的时间戳返回全 0。

你们能帮我解答一下吗?我潜伏了很长时间,这个网站在过去帮了我很多。

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com