What is {} in the SQL query? $ Sqlstr = "select & nbsp; name & nbsp; from & nbsp; user & nbsp; where & nbsp; id = '{$ row [0]}'"; what is the role of {} in the code I wrote? Thank you ~~, What is {} in "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 !!
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.