I have two questions:
To benefit from PDO prepared statements, should I first prepare a statement using a PDO object:
$statement = $pdo->prepare($query, $bindings);
and then store this $statement in $_SESSION and reuse this statement, or should I do the same thing (PDO::prepare) again next time I want to perform this same query (with different values for the bindings)?
- Is it useful to store the PDO object in $_SESSION when using PDO::ATTR_PERSISTENT when creating the PDO object ?