Mysql
 sql >> Database >  >> RDS >> Mysql

PHP che cambia la vecchia mysql_query in PDO

Per maggiori informazioni visita questo link:PHP DOP

in base al tuo esempio,

<?php

    $query = "UPDATE people 
             SET price=?, 
                 contact=?, 
                 fname=?, 
                 lname=? 
              WHERE id=? AND 
                    username=?";
    $stmt = $dbh->prepare($query);
    $stmt->bindParam(1, $price);
    $stmt->bindParam(2, $contact);
    $stmt->bindParam(3, $fname);
    $stmt->bindParam(4, $lname);
    $stmt->bindParam(5, $id);
    $stmt->bindParam(6, $username);    
    $stmt->execute();

?>

Dichiarazioni preparate DOP e stored procedure