An error occurs when running SQL statements. 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:
Reply to discussion (solution)
Change the full-width comma to a half-width comma.
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 ')");
Question about comma? No, it should be okay.
$ 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 ')");
I can't see whether my field is different from the number of inserted data, or is it not allowed to use Chinese as the field MYSQL ??
Your code has a line break before the rise or fall
If you use Chinese as the field name, you must note that the character set of the table is correct.
Character SET problems are nothing more than "mysql_query (" set names gb2312 ");
// Mysql_query ("set names UTF8"); "all tried, no. In addition, "your code clearly has a line break before the rise or fall", which is not included in the source code. Again, the question of comma has just been tried. Chinese comma, English comma, half-angle comma, and full-angle comma are useless. "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", "Transaction volume ', 'Commission by', 'date') values ('','', ''' at line 1"
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 ')");
Brother Shi is right. I tried it and it turned out to be a success. can you tell me the reason in detail? Why can't I write it? you can change it, and I don't see any difference between the two. Thank you.
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 ')");
Brother Shi is right. I tried it and it turned out to be a success. can you tell me the reason in detail? Why can't I write it? you can change it, and I don't see any difference between the two. Thank you.
1. some of the commas you wrote use Chinese commas.
Increase or decrease ', 'transaction volume', 'transaction volume ', 'Commission by', 'date') values ('','','','','','', '', '$ J ')");
2. $ 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 ')");
Here you have a line break, so no way.
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 ')");
Brother Shi is right. I tried it and it turned out to be a success. can you tell me the reason in detail? Why can't I write it? you can change it, and I don't see any difference between the two. Thank you.
1. some of the commas you wrote use Chinese commas.
Increase or decrease ', 'transaction volume', 'transaction volume ', 'Commission by', 'date') values ('','','','','','', '', '$ J ')");
2. $ 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 ')");
Here you have a line break, so no way.
Thanks, it seems that the foundation is not strong enough. you must continue to practice more.