Question about punctuation during SQL concatenation in php

Source: Internet
Author: User
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!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.