Table name, column name best use ' (ESC under that, do not ' error)
This starts with the effect of double quotes and single quotes:
The fields inside the double quotes are interpreted by the compiler and then exported as HTML code, but the single quotes do not need to be interpreted and output directly. For example:
$ABC = ' I love u ';
echo $ABC//result is: I love u
Echo ' $ABC '//Result: $ABC
echo "$ABC"//result is: I love u
So when you assign a value to a SQL statement inside a database, use double quotes inside the sql= "select A,b,c from ..."
But there are single quotes in the SQL statement that enclose the field names
For example: SELECT * FROM table where user= ' abc ';
The SQL statement here can be written directly as sql= "select * from table where user= ' abc '"
But if it looks like the following:
$user = ' abc ';
Sql1= "SELECT * from table where user= '". $user. " "; compare
Sql2= "SELECT * from table where user= ' abc '"
I have added a little space between the single and double quotation marks, and I hope you can see it clearly.
That is, replace ' abc ' with '. $user. ' Are all in a single quotation mark. Just split the entire SQL string.
SQL1 can be decomposed into the following 3 parts
1: "SELECT * from table where user= '"
2: $user
3: "'"
Used between strings. To connect
eg
$sql = ("select * from Myguests where username= $tureusername and password= $turepassword");
$sql = ("select * from myguests where username= '". $tureusername. "' and password= '". $turepassword. " ‘ " );
The two statements execute the same result, as long as they are understood in PHP. is the link character can be
MySQL single and double quotation marks