" " and Null the Difference
STRINGSTR1 = null; STR reference is empty
STRINGSTR2 = ""; str references an empty string
That is, NULL has no space allocated, "" is allocated space, so str1 is not yet an instantiated object, and STR2 has been instantiated.
Note Because NULL is not an object, "" is an object. So the comparison must be the IF (Str1==null) {...} And if (Str2.equals (")") {...}.
objects are compared with equals, and null is compared by an equal sign. Therefore, if str1=null, the following syntax error:
if (Str1.equals ("") | | Str1==null) {//If str1 has no value, then ....
。。。。
}
The correct wording is if (str1==null| | Str1.equals ("")) {///First judge is not an object, if yes, then determine if it is an empty string
//...
}
For example: An empty glass, you can not say that there is nothing in it, because there is air, of course, it can be made into a vacuum, null and "" The difference is like vacuum and air.
Use of quotation marks in SQL
Single quotes, double quotes, no quotes
numeric type without quotation marks
such as: scondition+= "and Larticleid =" + larticleid;//because Larticleid is a digital type, so no single quotes
Character type to be quoted in single quotation marks
such as: scondition+= "and stitle like '%" + stitle + "% '";
Compared to single quotes, the fields inside the double quotation mark are interpreted by the compiler and then exported as HTML code,
There is no need to explain in quotation marks, direct output. For example:
$ABC = ' I love u ';
echo $ABC//result is: ilove u
Echo ' $ABC '//Result: $ABC
echo "$ABC"//The result is: ilove u
So when you assign a value to the SQL statement inside the database, use double quotes inside the sql= "selecta,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, so you can understand.
Another very important point is whether it is a character or a numeric type, which must be defined in the database as a primary rather than a program, because SQL is run in the database.
"" and the difference between the null