Home > Backend Development > PHP Tutorial > php中关于sql拼接时标点符号出现的有关问题

php中关于sql拼接时标点符号出现的有关问题

WBOY
Release: 2016-06-13 11:56:38
Original
1053 people have browsed it

php中关于sql拼接时标点符号出现的问题
初学php,遇到了个奇怪的问题,让大侠们见笑了,拼接语句如下:

 $sql = 'select cat_id,cat_name,parent_id from ' . $this->table . ' where parent_id=' . $id;//能通过,正解<br /><br />  $sql = 'select cat_id,cat_name,parent_id from' . $this->table . 'where parent_id=' . $id;
Copy after login


为啥符号的空位不同,拼接的结果会有差异, 不解中,求解答?
------解决方案--------------------
你把两句输出之后对比下就知道了。
第一句....  from table where...
第一句....  fromtablewhere...

第二句中from 、table和where连在一起了,还能正确吗?

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template