2015-04-17 3 views
0
$db->query("UPDATE users SET solde = solde - '$aDeduire' WHERE telephone = '$msisdn'"); // works 
$db->query("UPDATE users SET solde = solde + '$montant' WHERE telephone = '$numaPayer'"); //works 
$db->query("UPDATE systems SET solde = solde + '$fraisTransaction' WHERE nom = 'SYSTEM'"); //works 
$db->query("INSERT INTO transactions (day, description, expediteur, destinataire, debit, credit, numserie) 

VALUES (NOW(), '$textExp', '$msisdn',null ,'$montant',null , '$numSerie')");// not working 

$db->query("INSERT INTO transactions (day, description, expediteur, destinataire, debit, credit, numserie) 

VALUES (NOW(), '$textDes't, null, '$numaPayer', null,'$montant', '$numSerie')"); // not working 

$db->query("INSERT INTO transactions (day, description, expediteur, destinataire, debit, credit, numserie) 

VALUES (NOW(), '$textSyst', null,'SYSTEM', null, '$montant', '$numSerie')");// not working 

Пожалуйста, помогите с этим кодом. Я пытаюсь вставить несколько дат сразу. что не так с кодом?Как вставить несколько запросов с объектами mysqli

+1

Что такое сообщение об ошибке вы получили? Узнайте о подготовленных statemens. И добавьте ddl. – Jens

+0

нет ошибки сообщение. –

+0

только когда я проверяю базу данных, ничего не вставлено –

ответ

0
$db->query("INSERT INTO transactions (day, expediteur, destinataire, debit, credit, description, numserie) 
       VALUES (NOW(), '$msisdn','' ,'$montant', 0, '$textExp', '$numSerie'), 
         (NOW(), '', '$numaPayer', 0,'$montant', '$textDest', '$numSerie'), 
         (NOW(), '$msisdn','', '$fraisTransaction', 0, '$textFrais', '$numSerie'), 
         (NOW(), '','SYSTEM', 0, '$fraisTransaction', '$textSyst', '$numSerie')"); 

вот как я решил его

приветы

Смежные вопросы