運行SQL語句時出現異常提示,求解

來源:互聯網
上載者:User
運行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)<1){
$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')");
  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    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.