我正在尝试掌握 PDO,但出现以下错误:
Call to a member function execute() on a non-object
这是我更新members
表格
的代码
$firstname = ($_POST['firstname']);
$lastname = ($_POST['lastname']);
$update = query("UPDATE members SET
firstname = '$firstname',
lastname = '$lastname',
WHERE id = '$id'" );
$q = $conn->prepare($update);
$q->execute(array($firstname,$lastname));
我在这里做错了什么?