我试图理解和阅读 PDO。
我刚刚写了以下内容,它工作正常,但我想知道它是否安全,因为我不逃避任何变量,是否仍然需要我逃避这些?
// Get Post Variables
$first_name = $_POST['first_name'];
$surname = $_POST['surname'];
$email_addr = $_POST['email_addr'];
$user_type = $_POST['user_type'];
// query
$sql = "UPDATE users
SET first_name=?, surname=?, email_addr=?, user_age=?, user_type=?
WHERE user_id=?";
$q = $conn->prepare($sql);
$q->execute(array($first_name,$surname,$email_addr,$user_age,$user_type,$uid));