Q&A
SQL syntax issues in PHP
Answer
I just learned PHP today. I watched the tutorial from Chung Yuan University
Now I am writing that counter and I encountered a problem
The insertion command given by phpmyadmin is this
$sql = 'INSERT INTO `test`.`counter` (`new` )VALUES ('1')';
But when I write it into the php file, I get an error and it must be changed to
$sql = 'INSERT INTO `test`.`counter` (`new` )VALUES (1)';
Just remove the quotation marks around 1.
I saw that there are quotation marks in the video. Why can't there be quotation marks in my case?
Let me answer
Netizens replied
Escaping quotes
Netizens replied
Look at the outermost double quotes in the video. [img]http://www.111cn.cn/bbs/images/smilies/default/loveliness.gif[/img]
Netizens replied
$sql = "INSERT INTO `test`.`counter` (`new` )VALUES ('1')";
Netizens replied
That tutorial is too old
Netizens replied
Original post by fanglq04 on 2009-4-7 11:04 [url=http://www.111cn.cn/bbs/redirect.php?goto=findpost&pid=939091&ptid=111565]Link tag[img]http:// www.111cn.cn/bbs/images/common/back.gif[/img][/url]
That tutorial is too old
I also think it’s a version issue, it seems I’ve encountered it before