The SQL query works on the testing server but doesn't live ... what's the difference?
SOLVE: I wrote and tested a PHP script on a local server. (Nothing fancy, just two consecutive SQL inserts in the same database, but different tables).
Both servers use PHP5 and MYSQL 5.
On the local server, both requests are processed correctly.
On a real server, only the first request works, but not the second, and I can't figure out why.
Here is the code:
$sql_login = "INSERT INTO logintbl
(...)
VALUES (...)";
$result_login = mysqli_query($this->connect, $sql_login);
# Fill contact details
$sql_contactD = "INSERT INTO contactDetails
(...)
VALUES (...)";
$result_contactD = mysqli_query($this->connect, $sql_contactD);
On my local server, both requests return true and the data is added to the database.
On my real server, the first request works as expected, but the second request fails with no error message.
Of course, the table structures are the same on both servers. Both tables are in the same database and the user has sufficient rights to the database.
Any hint on what might be wrong?
Edit 1: Permissions: Yes, the user has the corresponding permissions on both tables.
Edit 2: I feel very stupid, but following James' advice on checking mysqli_error () I found out that the production server is case sensitive about table names, unlike my test server, and that it converted the original to my table name ( contactDetails) in lowercase (contactdetails).
Thanks everyone for your help.
a source to share
Answering my own question, because it looks like the only way to close it correctly:
I feel very stupid, but following James's recommendation for checking mysqli_error (), I found out that the production server is case sensitive regarding table names, unlike my test server, and that it has converted my original table name (contactDetails) to the bottom register (Contactdetails).
a source to share