mysql - return query of pdo statements -
i querying database pdo prepared statements , can not figure out how return actual query after executing query.
have tried print_r($statement);
, give the pdo prepared query. appreciated!
$sql = ("select * `mysite` `info` :checksite or `users` :checksite"); $stmt = $pdo->prepare($sql); $stmt->bindparam(":checksite", "%$checksite%"); $stmt->execute(); $results = $stmt->fetchall(); foreach($results $row){ echo $row['users']; }
this quite complicated task , 1 of drawbacks of using prepared statements.
yet api doesn't offer such useful feature out of box. so, way raw sql parse placeholders manually. there home-brewed solutions in answer
Comments
Post a Comment