I have the following doubt about PDO:
If I will execute multiple queries I need to use bindParam method each time I call prepare?
Example:
$connection->prepare( "SELECT * FROM table WHERE y = :y" );
$connection->bindParam( ":y", $y );
$connection->prepare( "SELECT * FROM table2 WHERE y = :w" );
$connection->bindParam( ":w", $w );
OR Can I do better using something like:
$connection->bindParam( ":y", $y );
$connection->bindParam( ":w", $w );
$connection->prepare( "SELECT * FROM table WHERE y = :y" );
$connection->prepare( "SELECT * FROM table2 WHERE y = :w" );
OR:
$connection->prepare( "SELECT * FROM table WHERE y = :y" );
$connection->prepare( "SELECT * FROM table2 WHERE y = :w" );
$connection->bindParam( ":y", $y );
$connection->bindParam( ":w", $w );
¿Wich order and what is possible?