您的SQL语法有错误;查看与您的MySQL服务器版本对应的手册,以便在附近使用正确的语法

时间:2022-06-24 01:38:01

I've got problem about my HTML5 application.

我的HTML5应用程序有问题。

If I submit the form, I got this message:

如果我提交表单,我收到此消息:

 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 'Left, Width, Height, Opacity) VALUES ('DADobjImg1-1',1,87,8,200,184,100)' at line 1

and this is my code...

这是我的代码......

if($DADimg != "0" || $DADimg != "undefined"){
for($i = 1; $i <= $DADimgs; $i++){
if($_POST["DADobjPropI".$i] != "" || $_POST["DADobjPropI".$i] != "undefined"){
$DADgenNameI = $_POST["DADobjPropF".$i]."-".$DADtableRow;
$DADimg1 = $_POST["DADobjPropI".$i];
$DADimg2 = $_POST["DADobjPropY".$i];
$DADimg3 = $_POST["DADobjPropX".$i];
$DADimg4 = $_POST["DADobjPropW".$i];
$DADimg5 = $_POST["DADobjPropH".$i];
$DADimg6 = $_POST["DADobjPropO".$i];
mysql_query("INSERT INTO images (ID, Image, Top, Left, Width, Height, Opacity) VALUES ('$DADgenNameI',$DADimg1,$DADimg2,$DADimg3,$DADimg4,$DADimg5,$DADimg6)") or die (mysql_error());
if($i <= $DADimgs && $i==1){$DADsepStartI="['";}else{$DADsepStartI="'";}
 if($i == $DADimgs){$DADsepEndI="']";}else{$DADsepEndI="',";}
 $DADimages=$DADimages.$DADsepStartI.$DADgenNameI.$DADsepEndI;
 echo $DADgenNameI." ".$DADimg1." ".$DADimg2." ".$DADimg3." ".$DADimg4." ".$DADimg5." ".$DADimg6."<br/>";
 }
 }
 }

I try to use mysql_real_escape_string() but this problem still appear...

我尝试使用mysql_real_escape_string()但这个问题仍然出现......

anyone can help me?

有人可以帮帮我吗?

1 个解决方案

#1


1  

Left is a keywords. Use bakticks

左边是关键字。使用bakticks

`Left`

Consider stopping using mysql_ functions. They are deprecated. Use PDO or mysqli instead

考虑停止使用mysql_函数。它们已被弃用。请改用PDO或mysqli

#1


1  

Left is a keywords. Use bakticks

左边是关键字。使用bakticks

`Left`

Consider stopping using mysql_ functions. They are deprecated. Use PDO or mysqli instead

考虑停止使用mysql_函数。它们已被弃用。请改用PDO或mysqli