I’m getting this Catchable fatal error: Object of class PDOStatement could not be converted to string. I’m getting data from one table and inserting into another. I’m trying to find the proper way to convert to string coming from a PDO object. If anyone could point me in the right direction it. Greatly appreciated. Thanks.
Oh, here is some code I’m using:
while ($row = $query->fetch()) {
$reasons = explode(',', $row->invalid_reason);
$query_reasons = $handler->prepare("INSERT INTO invalid_reasons (submission_id, invalid_reasons) VALUES(?,?)");
foreach ($reasons as $r) {
$query_reasons .= "('{$row->submission_id}','{$r}'),";
}
// omit tailing ,
trim($query_reasons, ',');
$handler->query($query_reasons);
}