The question of punctuation during SQL concatenation in php is a strange problem for beginners. The following is a splicing statement:
$ SQL = 'SELECT cat_id, cat_name, parent_id from '. $ this-> table. 'Where parent_id = '. $ id; // pass, positive solution $ 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?
Reply to discussion (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?
Select cat_id, cat_name, parent_id fromcategorywhere parent_id = 42 delete from category where cat_id = 42
It ran too fast and the foundation was not completed. thank you for your notice!