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;
为啥符号的空位不同,拼接的结果会有差异, 不解中,求解答?
------解决方案--------------------你把两句输出之后对比下就知道了。
第一句.... from table where...
第一句.... fromtablewhere...
第二句中from 、table和where连在一起了,还能正确吗?
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