PDO query error

-3

I have the following code:

@$import = $dbconn->prepare("UPDATE t SET");

if(a <> "")
{
$import .= "teste2= '$a', teste= '$b', ";
...

It returns this error:

Catchable fatal error: Object of class PDOStatement could not be converted to string in

The error is in the line in which I concatenate the variable the query, When I run the query in the database it works normally.

    
asked by anonymous 27.11.2018 / 16:25

1 answer

0

I think it would be something +/- so you can concatenate text with text and not text with object ...

$import = "UPDATE t SET ";

if(a <> ""){
  $import .= "teste2 = '$a', teste= '$b' ";
}

$dbconn->prepare($import);
    
27.11.2018 / 16:34