php - PDO bindParam right way? -
hey quick little question.
what better or safest way bind parameters, values , columns? i'v seen these 2 ways it, can't figure out difference is?
with :email , :email, $email
$stmt = $db->prepare( "select `email` `users` `email` = :email"); $stmt->bindvalue( ':email', $email ); or questionmark ?
$stmt = $db->prepare( "select `email` `users` `email` = :?"); $stmt->bindvalue( 1, $email );
no difference advantage more readable.
mysqli has ? not nice read when got many parameters
imagine this:
$stmt = $db->prepare( "call store_procedure ?,?,?,?,?,?,?,?,?,?"); it more error prone , hard debug
Comments
Post a Comment