Php beginners encountered a strange problem about punctuation during SQL concatenation. the splicing statement was as follows: & nbsp; $ SQL & nbsp; select & nbsp; cat_id, cat_name, parent_id & nbsp; from & nbsp ;. & nbsp; $ this-& gt; table & nbsp ;. & nbsp; question about punctuation during SQL concatenation in php
When I was a beginner in php, I encountered a strange problem. I laughed at the heroes. the splicing statement is as follows:
$ SQL = 'SELECT cat_id, cat_name, parent_id from '. $ this-> table. 'where parent_id ='. $ id; // Yes
$ SQL = 'SELECT cat_id, cat_name, parent_id from '. $ this-> table. 'where parent_id ='. $ id;
Why is there a difference in the splicing results due to the space difference of symbols?
------ Solution --------------------
After you compare the two sentences, you will know.
The first sentence... from table where...
The first sentence... fromtablewhere...
In the second sentence, can the from, table, and where statements be correctly connected?