MySQLi - Error handling?

Status
Not open for further replies.

Sledmore

Chaturbate Livestreamer
Staff member
FindRetros Moderator
Jul 24, 2010
5,199
3,934
Hey,

I'm having ago at using MySQLi and doing a little CMS for a project, and I have a question, I have my MySQL server on strict so sometimes I need to see an error, what is the way to do this whilst doing a query?

Example, with mysql you can just use 'or die(mysql_error());'.

- Thanks.
(I'm a noob at OOP and MySQLI, :D).
 

Sledmore

Chaturbate Livestreamer
Staff member
FindRetros Moderator
Jul 24, 2010
5,199
3,934
Try:
Code:
 echo $mysqli->error;
(change mysqli to what your connection variable is)

Thanks, had an idea on that, just was too stupid to try it how it's actually done;

'or die($mysqli->error);'

Worked fine, why I didn't try that before, no idea.
 
Status
Not open for further replies.

Users who are viewing this thread

Top