-2
I’m trying to insert some data into a table using PHP and some errors are happening.
This is the way I’m using to insert:
$cnpj = "000001";
$sth = $lokos->prepare("INSERT INTO CLENTES (CNPJ) VALUES (?)");
$sth->bindParam(1, $cnpj, PDO::PARAM_STR);
$sth->execute();
$result = $sth->fetch(PDO::FETCH_ASSOC);
echo $sth;
I’m trying to insert data into the table CLENTES
in the CNPJ field and this error is happening:
( ! ) Catchable fatal error: Object of class PDOStatement could not be converted to string in C:\wamp\www\site\index.php on line 30
Call Stack
# Time Memory Function Location
1 0.0000 134952 {main}( ) ..\index.php:0
What can I do to fix this?
According to the error is saying that the function failed to convert the value to
string
, and if you worked with valuesint
? The table name really isCLENTES
orCLIENTES
– Tiago Boeing
A lot of people have given different answers. State whether your question has been resolved or not, so that they can help you or learn that you have already been helped. And click on the "accept as answer" button in the answer that helped you.
– Silva97