Home  >  Article  >  Backend Development  >  运行SQL语句时出现异常提示,求解

运行SQL语句时出现异常提示,求解

WBOY
WBOYOriginal
2016-06-13 11:57:301674browse

运行SQL语句时出现错误提示,求解
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");//包含文件,这里没有提供,是关于数据库建立和执行SQL语句的,可以自行编写
 //$link = create_connection();//同上
mysql_query("SET NAMES gb2312");
//mysql_query("SET NAMES UTF8");
           $sql="select * from abc";
$result = execute_sql("data", $sql, $link);//此函数在包含文件中,没有提供,可自行编写

if(mysql_num_rows($result)$query=mysql_query("insert into abc (`股票代码`,`股票名称`,`行情时间`,`最新价`,`昨收盘`,`今开盘`,`涨跌额`,`最低价`,`最高价`,`

涨跌幅`,`成交量`,`成交额`,`委比`,`日期`) values('','','','','','','','','','','','','','$j')");
if($query!=true){echo "exit".mysql_errno().mysql_error();}
echo "sucess";}
?>
运行后出现如下提示运行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 ',`成交量`,`成交额`,`委比`,`日期`) values('','','','','','','',''' at line 1:
------解决方案--------------------
把里面的全角逗号改为半角的再说。
------解决方案--------------------
改成这样应该可以了。
$query=mysql_query("insert into abc (`股票代码`,`股票名称`,`行情时间`,`最新价`,`昨收盘`,`今开盘`,`涨跌额`,`最低价`,`最高价`,`涨跌幅`,`成交量`,`成交额`,`委比`,`日期`) values('','','','','','','','','','','','','','$j')");

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn