$query = "insert into books values ('".$isbn."', '".$author."', '".$title."', '".$price."')";
Reply content:
$query = "insert into books values ('".$isbn."', '".$author."', '".$title."', '".$price."')";
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