Why is the empty minus null output 0?
There is a table UUU, with only 1 data, as follows:
$AAA = false;
Query statement: ' SELECT * from UUU where id= '. $aaa
Does this query return false, or ', or null, or what?
I tried this:
$k = '-';
$k = Null-null;
Echo $k;
The output is all 0.
------to solve the idea----------------------
$AAA =false;
$sql = ' SELECT * from UUU where id= '. $aaa;
Var_dump ($sql);
False is an empty string when connected to a string
Output is String ("select * from UUU where id=")
The above SQL MySQL syntax detection does not pass so you return false to indicate that the query failed
------to solve the idea----------------------
To see the value of the variable, do not use echo, use Var_dump
------to solve the idea----------------------
Your query directive returns an empty record, so it doesn't matter if it's false, or ', or null
When the recordset is not empty and the field value is null, except that PDO can be specified, other database functions return "(empty string)
------to solve the idea----------------------
$AAA = false;
Query statement: ' SELECT * from UUU where id= '. $aaa
Returned to an empty record because there was no match for Id=false.
$k = '-';
$k = Null-null;
Var_dump ($k);