ThingEngineer / PHP-MySQLi-Database-Class

Wrapper for a PHP MySQL class, which utilizes MySQLi and prepared statements.
Other
3.3k stars 1.34k forks source link

insert query doesn't insert data into the table. #759

Open sugumarv opened 6 years ago

sugumarv commented 6 years ago

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' => 'payer@paypal.com', 'ipn_track_id' => '98789789kjhkjh', 'payer_id' => 'KLHJ987KH98', 'payer_business_name' => NULL, 'first_name' => 'sugumar', 'last_name' => 'venkatesan', 'userid' => '987', 'receiver_email' => 'MYEMAIL@gmail.com', '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', 'payer@paypal.com', '98789789kjhkjh', 'KLHJ987KH98', 'NULL', 'sugumar', 'venkatesan', '987', 'MYEMAIL@gmail.com', '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.

trayan16 commented 6 years ago

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

VeNoMouS commented 6 years ago

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

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

enrybisco commented 3 years ago

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