When running SQL statements, an error message is displayed. how can this problem be solved ;? Phpdate_default_timezone_set (AsiaShangHai); $ hdate (H: I: s); & nbsp; $ jdate (Y-m-d); & nbsp; $ kdate (Y-m-d & nbsp; H: I: s); require_once (dbtools. inc. php); when running SQL statements, an error prompt is displayed.
Date_default_timezone_set ("Asia/ShangHai ");
$ H = date ("H: I: s ");
$ J = date ("Y-m-d ");
$ K = date ("Y-m-d H: I: s ");
// Require_once ("dbtools. inc. php"); // contains the file, which is not provided here. it is about database creation and execution of SQL statements. you can compile it yourself.
// $ Link = create_connection (); // same as above
Mysql_query ("set names gb2312 ");
// Mysql_query ("set names UTF8 ");
$ SQL = "select * from abc ";
$ Result = execute_ SQL ("data", $ SQL, $ link); // This function is not provided in the included files. you can compile it yourself.
.
If (mysql_num_rows ($ result) <1 ){
$ Query = mysql_query ("insert into abc ('stock code', 'Stock name', 'market time', 'latest price', 'closing close ', 'opening today ', 'ups and downs ', 'lowest price', 'Highest price ','
Increase or decrease ', 'transaction volume', 'transaction volume ', 'Commission by', 'date') values ('','','','','','', '', '$ J ')");
If ($ query! = True) {echo "exit". mysql_errno (). mysql_error ();}
Echo "sucess ";}
?>
After running, the following message is displayed: run 1064You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ', 'transaction volume ', 'Turnover ', 'Commission by', 'date') values ('','','','','','','', '''at line 1:
------ Solution --------------------
Change the full-width comma to a half-width comma.
------ Solution --------------------
This should be done.
$ Query = mysql_query ("insert into abc ('stock code', 'Stock name', 'market time', 'latest price', 'closing close ', 'opening today ', 'maximum sales', 'lowest price', 'maximum price', 'maximum sales', 'transaction volume ', 'transaction amount', 'Commission by', 'date') values ('', '','','','','','','','','','','','', '$ J ')");