recover mysql error message with php

Asked

Viewed 121 times

1

Good guys, I know check the error code, but do not know how to recover the error message.

Follow my example:

$conexao->query($query);
$erro = "Errorcode: $conexao->errno";

I want to make the message appear and not the code. How do I do this?

  • is errno even ?

  • yes, it returns the code, need the error message.

  • Ta using PDO ?

  • I’m not using mysqli

1 answer

4


Must be the concatenation!

$conexao->query($query);
$erro = "Errorcode: ".$conexao->errno; //Assim aparece o numero do erro da mensagem
$erro = "Errorcode: ".$conexao->error; //Assim aparece a mensagem
  • Well I want the message to appear and not the code. This way it looks like 'Errorcode: 1146'. It is better if it is the error.

  • 2

    $error = "Errorcode: ". $connected->error;

  • blz, change your answer there please

Browser other questions tagged

You are not signed in. Login or sign up in order to post.