MySQL 1064 error means that My SQL syntax is incorrect and the specific location of the error is displayed.
View the content to be updated and execute new php statements.
The php statement is as follows:
If (! $ Handle = @ fopen ($ fname, "r") {echo "open $ fname failed \ n"; exit ;};
$ Str = ""; $ count = 0;
$ Ins = "insert into pydot_g (id, aauthor) VALUES ";
While ($ buf = fgets ($ handle, 1000 ))! = False ){
List ($ id, $ field) = explode ("#", $ buf );
$ Str. = sprintf ('(% d,' % s'), ', $ id, $ field );
$ Count ++;
}
$ Str. = "(3955, '123 ')";
$ Dup = "on duplicate key update aauthor = VALUES (aauthor );";
$ SQL = $ ins. $ str. $ dup;
// Echo $ SQL. "\ n ";
If (! Mysql_query ($ SQL ))
{Echo "mysql failed \ n ";
Echo mysql_errno (). ":". mysql_error (). "\ n ";}
Fclose ($ handle );
Mysql_close ($ link );
The content to be updated is as follows:
1320 # CarryDream Int 'l Co., Ltd.
1321 # es app Group
1322 # app4uu
It can be found that there are still single quotation marks (') in the content to be followed, and the fields printed in the SQL statement also contain single quotation marks, which conflict with each other.
So the solution is to change the SQL statement to the double quotation mark "", so this problem can be solved.
MySQL ERROR: ERROR 1064 (42000): use near 'order' to solve
MySQL reports ERROR 1044 ERROR 1064 (42000 ):