0

I have tried to fix the query but it still doesn't work

This is the error:

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

从 account_requests 中删除,其中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 (usr_usr_id , account_type_type_id ) VALUES (, 2); UPDATE transaction SETorder_status = 'Completed' WHEREusr_id = ANDpurchase_type = 'Account Upgrade' ANDorder_status = 'Pending' ANDitem` = 'Tutor Account';

文件名:C:\Users\Supremekhaoz\Downloads\Dropbox\htdocs\codeg\system\database\DB_driver.php

行号: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';
4

2 回答 2

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的价值,我认为它没有价值

于 2012-08-23T02:30:09.937 回答
0
$this->db->where('usrs_id',$usr_id);
$this->db->where('account_requesting',$type_id);
$this->db->delete('account_requests ');

您可以使用此代码删除

于 2018-05-11T10:00:00.203 回答