![如何准备更新查询语句?[重复],第1张 如何准备更新查询语句?[重复],第1张](/aiimages/%E5%A6%82%E4%BD%95%E5%87%86%E5%A4%87%E6%9B%B4%E6%96%B0%E6%9F%A5%E8%AF%A2%E8%AF%AD%E5%8F%A5%EF%BC%9F%5B%E9%87%8D%E5%A4%8D%5D.png)
一个
UPDATE与插入或选择相同。只需将所有变量替换为
?。
$sql = "UPDATE Applicant SET phone_number=?, street_name=?, city=?, county=?, zip_pre=?, day_date=?, month_date=?, year_date=? WHERe account_id=?";$stmt = $db_usag->prepare($sql);// This assumes the date and account_id parameters are integers `d` and the rest are strings `s`// So that's 5 consecutive string params and then 4 integer params$stmt->bind_param('sssssdddd', $phone_number, $street_name, $city, $county, $zip_pre, $day_date, $month_date, $year_date, $account_id);$stmt->execute();if ($stmt->error) { echo "FAILURE!!! " . $stmt->error;}else echo "Updated {$stmt->affected_rows} rows";$stmt->close();欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)