What is {} in the SQL query? What should I do?

Source: Internet
Author: User
What is {} in the SQL query? $ Sqlstrselect & nbsp; name & nbsp; from & nbsp; user & nbsp; where & nbsp; the code I wrote. what is the role of {} in it? Thank you ~~ ------ Solution ------------------ in the string, {variable} is used to indicate the value of a variable. what is {} in the SQL query?
$ Sqlstr = "select name from user where id = '{$ row [0]}'";

What is the role of {} in the code I wrote?

Thank you ~~
------ Solution --------------------
In the string "", {variable} is used to reference the value of a variable. of course, it can be used normally without adding brackets in most cases, but it is a good habit to add braces.
------ Solution --------------------
The content enclosed by braces "{}" indicates a whole.
Anything that may be ambiguous should be enclosed in curly brackets "{}".
For example, multiple lines of code in your sample code and condition statement branch, etc.
------ Solution --------------------
{} Is actually a block, a whole.
------ Solution --------------------
It is declared that this is a variable, because sometimes "" and ''will encounter errors, which avoids
------ Solution --------------------
This is basically used to enclose variables, which can be safely used as real variables in strings.
------ Solution --------------------
This has nothing to do with SQL. you have explained the role upstairs.
------ Solution --------------------
It seems that there is little relationship.
------ Solution --------------------
The difference is not big. one is to repair the house without a security helmet, and the other is to repair the house with a security helmet !!

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.