MySQL Forums
Forum List  »  PHP

Re: Data not being entered into database
Posted by: Peter Brawley
Date: March 13, 2016 10:47AM

Stop using the mysql API. It is deprecated and will soon be removed. Use the mysqli API: mysqli_connect(), mysqli_query() &c.

All MySQL calls that can elicit errors need error control: at a minimum ...

$conn = mysqli_connect(...) or exit( mysqli_connect_error() );

$res = mysqli_query(...) or exit(Z Zmysqli_error($conn) );

... and so on.

The error messages will point you at the bugs you've written. When a query still yields unexpected results, after formulating it ...

$qry = "insert ...";

... add ...

exit($qry) to the script to see the actual query your script is sending to MySQL, and if necessary copy & paste it into the myssql client to see what bugs your code has implanted in it.

Options: ReplyQuote


Subject
Written By
Posted
Re: Data not being entered into database
March 13, 2016 10:47AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.