2012-08-23 114 views
0

我已經嘗試了查詢,但它仍然無法正常工作笨查詢不能

這是錯誤:

Error Number: 1064

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 user_notifications (id, usr_id , notification_message , sender`,' at line 3

DELETE FROM account_requests WHERE usrs_id = '' AND account_requesting = '2'; INSERT INTO user_notifications (id, usr_id , notification_message , sender , show, date ) VALUES (NULL, '', 'Successful account upgrade. You are now a Tutor', 'Codeg Account Wizard', 1, CURDATE()); INSERT INTO usrs_acc_type ( usrs_usr_id , account_type_type_id ) VALUES (, 2); UPDATE transaction SET order_status = 'Completed' WHERE usr_id = AND purchase_type = 'Account Upgrade' AND order_status = 'Pending' AND item` = 'Tutor Account';

Filename: C:\Users\Supremekhaoz\Downloads\Dropbox\htdocs\codeg\system\database\DB_driver.php

Line Number: 330

查詢:

DELETE FROM account_requests WHERE `usrs_id` = '$usr_id' AND `account_requesting` = '$type_id'; 

INSERT INTO user_notifications (`id, `usr_id`, `notification_message`, `sender`, show, `date`) VALUES (NULL, '$usr_id', 'Successful account upgrade. You are now a $type', 'Codeg Account Wizard', 1, CURDATE()); 

INSERT INTO usrs_acc_type (`usrs_usr_id`, `account_type_type_id`) VALUES ($usr_id, $type_id); 

UPDATE `transaction` SET `order_status` = 'Completed' WHERE `usr_id` = $usr_id AND `purchase_type` = 'Account Upgrade' AND `order_status` = 'Pending' AND `item` = '$type Account'; 
+1

尋找** INSERT INTO user_notifications('id,** id has 1 missing quote – rechie

回答

2

如果你是使用codeigniter爲什麼你沒有嘗試激活記錄

$data = array(
    'id' => NULL , 
    'usr_id' => $usr_id , 
    'notification_message' => 'Successful account upgrade. You are now a '.$type, 
    'sender' => 'Codeg Account Wizard', 
    'show' => 1, 
    'date' => time() 
); 

$this->db->insert('user_notifications', $data); 

也檢查你的$usr_id有一個值,我認爲它沒有價值