retrieve mysql error message with php

1

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

Here's my example:

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

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

    
asked by anonymous 02.03.2017 / 21:02

1 answer

4

It should 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
    
02.03.2017 / 21:09