Problem Description:
Using PHP to modify data in the MySQL database, to implement additions and deletions (the database can be properly connected) tested, the code can only be used for the normal number of additions and deletions, non-numeric operation is invalid but in the course name to enter Chinese, should be modified? The code that has the problem is mainly: < span=""> <> < span=""> , $kkxq, $xs < span=""> , $XF) " < span=""> < span="">The code (the code is correct) is as follows: < span=""> < span="">
< span="">< span="">< span="">
< span="">
<>< span="">< span="">
<>< span="">< span="">
<>< span="">< span="">
<>< span="">< span="">
<>< span="">< span="">
<>
< span="">< span="">
< span="">< span="">< span="">
< span="">
<>< span="">< span="">
<>< span="">< span="">
<>< span="">< span="">
<>< span="">< span="">
<>< span="">< span="">
<>< span="">
< span="">< span="">
< span="">< span="">< span="">
< span="">
<>< span="">< span="">
<>
< span="">< span="">< span="">
< span="">
< span="">< span="">
< span="">Because it is only valid for numbers, it is speculated that there is a problem with the data types passed into the database. However, the data type obtained by Var_dump ($KCM) is a string type.
What about passing string variables to the database? tested: A possible way is to add a single quotation mark to the string variable in the line code: < span=""> <> ' $kcm < span=""> ', $kkxq, $xs, $XF) "< span=""> But think, PHP in double quotation marks to parse the variable, so it is a little confusing, so Baidu a bit< span="">。< span="">Worth a look: http://www.jb51.net/article/21035.htm from this link, understand some of the problems. Summarized as follows:
< span="">1, Simple summary: The variable in double quotes can be parsed, single quotation marks are absolute strings. Single quotes, double quotes must be used in pairs, 2, the "\" backslash in single quotation marks is output directly, and the backslash in double quotation marks is resolved to escape character.
< span="">、
PHP Complex variables are enclosed in curly braces, and the parser can parse them correctly。 Such as:
< strong="">< span="">
< span="">, the SQL statement that is inserted into the database uses single quotation marks to define the string.If you want to insert a string containing single quotation marks into the database, use the escape character. < span=""> the addslashes () function, which functions: Adds a backslash
before the specified predefined character.
double quotation mark (")
backslash (\)
Null Http://zh.wikipedia.org/wiki/SQL%E6%B3%A8%E5%85%A5%E6%94%BB%E5%87%BB http ://welcome6.blog.163.com/blog/static/189281346201001694237345/
from the notes (Wiz)
http://www.bkjia.com/phpjc/761103.html www.bkjia.com true http://www.bkjia.com/phpjc/761103.html techarticle problem description: Using PHP to modify data in the MySQL database, to achieve additions and deletions (the database can be properly connected) tested, Code can only be used to correct the number of additions and deletions, non-digital operation ...