An exception occurs when running SQL statements.

Source: Internet
Author: User
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 ')");

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.