Home  >  Article  >  Backend Development  >  SQL syntax issues in PHP_PHP tutorial

SQL syntax issues in PHP_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 10:51:13840browse



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


www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/632573.htmlTechArticleQ&A Answers to SQL syntax questions in PHP I just learned PHP today. I watched the tutorial from Chung Yuan University and am writing that one now. Counter, I encountered a problem. The insert command given by phpmyadmin is this...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn