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 CLENTES
table in the CNPJ field and this error is occurring:
( ! ) 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?