-1

I could ignore this but would rather find out why it not acting as I imagine.

I have this query:

$updateQuery = $mysqli->query(
    "UPDATE `enquiries`
    SET `customer_id` = '$customer_id'
    WHERE `email` = '$email'"
) or die('Error:'.mysql_error());

After this query I simply echo out

 echo "Query Complete";

The query is only part of a longer script, before I added this query the Query Complete message was echoed out.

After adding this query nothing was shown. So I added the:

or die('Error:'.mysql_error());

To debug but it simply shows 'Error:' and not any errors. My question is that the query itself actually runs fine, and updates the rows as neeeded but it kills the script still.

Where am I going wrong with this? Thanks.

Lovelock
  • 7,689
  • 19
  • 86
  • 186
  • 4
    You're mixing up mysql and mysqli. –  Feb 11 '15 at 09:46
  • And since you're using the object-oriented interface, you need to use `$mysqli->error` to get the last error. –  Feb 11 '15 at 09:47
  • `mysql_error` can only give you errors for connections established via `mysql_*`. You're using mysqli. They're completely different things. – deceze Feb 11 '15 at 09:47
  • 2
    An an aside: don't use `die` for error handling. – Sherlock Feb 11 '15 at 09:48

1 Answers1

3

You're mixing up mysql and mysqli, which obviously won't work, in your case you were looking for mysqli_error but even then it won't work because you use the object-oriented interface.

Use $mysqli->error to access the last error string, as described in the documentation.