簡體   English   中英

phpMyAdmin執行時MySQL查詢無法執行

[英]MySQL query fails to execute while phpMyAdmin executes

我正在嘗試執行下一個查詢:

BEGIN;
INSERT INTO `jobs` ( `client` , `client_name` , `type` , `workers` , `date` , `hours` , `comments` , `project` ) VALUES ( '1' , 'one' , '1' , '1,2,5' , '2012-12-13' , '1234f' , '' , '0' ); 
INSERT INTO `jobs` ( `client` , `client_name` , `type` , `workers` , `date` , `hours` , `comments` , `project` ) VALUES ( '5' , 'two' , '3' , '1,2,5' , '2012-12-13' , '12' , '' , '0' ); 
COMMIT;

這將返回下一個MySQL錯誤:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INSERT INTO `jobs` ( `client` , `client_name` , `type` , `workers` , `date` , `h' at line 1

同時,phpMyAdmin設法執行該查詢。

有人可以指出可能的原因嗎?

您可以嘗試:

INSERT INTO `jobs` ( `client` , `client_name` , `type` , `workers` , `date` , `hours` , `comments` , `project` ) 
    VALUES ( '1' , 'one' , '1' , '1,2,5' , '2012-12-13' , '1234f' , '' , '0' )
    ,( '5' , 'two' , '3' , '1,2,5' , '2012-12-13' , '12' , '' , '0' ); 

這將在一條語句中為您提供兩個插入。

這不是“ a”查詢。 這是4個查詢。 在PHP中,您將不得不調用mysql_query四次。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM