Problems related to punctuation during SQL concatenation in php

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

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.