Jump to content

json encode prepared statement errors


jimfog

Recommended Posts

I have the following prepared statement json_encode error checking code:

...$stmt->bind_param('siisi',$name,$start,$end,$origin,$staf,$bookedfor);             $stmt->execute();             if($stmt->errno!==0)             {printf("Error-execution failed : %s.n", $stmt->error);              return  false;             }...

How I could possibly json_encode the above error?

The point here is that a conditional "waits" in the client to evaluate such an error.

I cannot do that with the way the code is above.

 

I do see the warning message being sent from the message but it is worthless...I want to take a specific action based on it.

Link to comment
Share on other sites

Why do you need to JSON-encode a string? You could put it in an object or array and encode that I guess. But if you only need a string I don't see a reason to put it in a data structure and then encode it.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...