http://code.tutsplus.com/tutorials/pdo-vs-mysqli-which-should-you-use–net-24059
อ่านจ้ะ
$params = array(':username' => 'test', ':email' => $mail, ':last_login' => time() - 3600); $pdo->prepare(' SELECT * FROM users WHERE username = :username AND email = :email AND last_login > :last_login'); $pdo->execute($params);
และอีกหลายตัวอย่าง ดีมากๆ