题目内容
PDO 中使用了预处理语句并绑定参数补全代码:(16分)setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); // 预处理 SQL 并绑定参数$stmt = $conn->__________("INSERT INTO MyGuests (firstname, lastname, email) VALUES (_________, :lastname, :email)");$stmt->bindParam(':firstname', $firstname);$stmt->bindParam(':lastname', $lastname);$stmt->bindParam(':email', $email);// 插入行$firstname = "John";$lastname = "Doe";$email = "john@example.com";$stmt->____________();echo "新记录插入成功";} catch(PDOException$e){ echo "Error: " . $e->getMessage(); }$conn = null;?>
查看答案
搜索结果不匹配?点我反馈