views:

274

answers:

3

SOLVED: I wrote and tested a PHP script on the local server. (Nothing fancy, just 2 consecutive SQL inserts in the same database, but different tables).

Both servers run PHP5 & MYSQL 5.

On the local server, both queries are processed correctly.

On the live server, only the first query 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 queries return true and the data are added in the database.

On my live server, the first query works as expected, but the second query fails without any error message.

Of course, the table structures are identical on both servers. Both tables are in the same database and the user has sufficient rights on the database.

Any clue on what could be wrong?


Edit 1: Permissions: Yes, the user has adequate permissions on both tables.


Edit 2: I am feeling very silly, but following James' advice of checking mysqli_error(), I found out that the production server was case sensitive in regards to table names, unlike my testing server, AND that it converted the original name of my table (contactDetails) to lowercase (contactdetails).

Thanks to all for your help.

A: 

have you checked permissions in your Production environment? Meaning have you verified that you have insert access to contactDetails?

northpole
Yes, sorry, I should have specified, but, yes, the permissions are adequate.
Sylverdrag
A: 

Did you try to print $sql_contactD to a screen (or webpage), and then run the exact same query in the MySQL Query Browser?

Andomar
A: 

Answering my own question because it looks like the only way to close it properly:

I am feeling very silly, but following James' advice of checking mysqli_error(), I found out that the production server was case sensitive in regards to table names, unlike my testing server, AND that it converted the original name of my table (contactDetails) to lowercase (contactdetails).

Sylverdrag