PHP-MySQLi-Database-Class icon indicating copy to clipboard operation
PHP-MySQLi-Database-Class copied to clipboard

insert query doesn't insert data into the table.

Open sugumarv opened this issue 7 years ago • 3 comments

Following is the query I am trying to execute from

$data_paypal = array ( 'payment_date' => '23:03:24 May 29, 2018 PDT', 'txn_id' => 'LKJKL98798JH987987', 'verify_sign' => 'lkjkljkjlkjklj9878979jklhjJKHKJHLKJLJ98798kljhljlkjl', 'payer_email' => '[email protected]', 'ipn_track_id' => '98789789kjhkjh', 'payer_id' => 'KLHJ987KH98', 'payer_business_name' => NULL, 'first_name' => 'sugumar', 'last_name' => 'venkatesan', 'userid' => '987', 'receiver_email' => '[email protected]', 'receiver_id' => 'LKJHLJ987KJH987', 'type' => 'jobpost', 'ipnreceivedate' => '2018-05-30 11:33:36', 'gateway' => 'paypal', 'amount' => '500.00', ); $db->setTrace (true); $paypalpayments_insert_id = $db->insert('mytablename',$data_paypal); print_r ($db->trace); echo $paypalpayments_insert_id;die();

$db->trace shows the following:

   
  Array
  (
  [0] => Array
  (
  [0] => INSERT INTO mytablename (payment_date, txn_id, verify_sign, payer_email, ipn_track_id, payer_id, payer_business_name, first_name, last_name, userid, receiver_email, receiver_id, type, ipnreceivedate, gateway, amount) VALUES ('23:03:24 May 29, 2018 PDT', 'LKJKL98798JH987987', 'lkjkljkjlkjklj9878979jklhjJKHKJHLKJLJ98798kljhljlkjl', '[email protected]', '98789789kjhkjh', 'KLHJ987KH98', 'NULL', 'sugumar', 'venkatesan', '987', '[email protected]', 'LKJHLJ987KJH987', 'jobpost', '2018-05-30 11:33:36', 'paypal', '500.00')
  [1] => 0.000188112258911
  [2] => MysqliDb->insert() >> file "/home/mysite/public_html/mysite/viewjob.php" line #58
  )
   
  )
 

but it doesn't insert anything into the mytablename, but the query displayed using $db->trace runs correctly in the phpmyadmin ie inserts a new row.

sugumarv avatar May 30 '18 06:05 sugumarv

I have exactly the same problem, No errors with the query, but there's no row inserted.

trayan16 avatar May 31 '18 21:05 trayan16

Have you tried running it as a transaction and committing after the fact?

https://github.com/ThingEngineer/PHP-MySQLi-Database-Class#transaction-helpers

VeNoMouS avatar Jun 18 '18 22:06 VeNoMouS

solved by my code: add this: https://github.com/ThingEngineer/PHP-MySQLi-Database-Class/pull/954

enrybisco avatar Jul 22 '21 14:07 enrybisco