gpt4 book ai didi

php - 使用 php 更新现有的 mysql 记录

转载 作者:行者123 更新时间:2023-11-29 04:57:13 24 4
gpt4 key购买 nike

尝试更新 phpMyAdmin 中的现有记录,但以下代码似乎不起作用。

<?php 
$id = stripslashes($_POST['id']);

$title = stripslashes($_POST['title']);
$first = stripslashes($_POST['first']);
$surname = stripslashes($_POST['surname']);
$email = stripslashes($_POST['email']);
$promotion = stripslashes($_POST['promotion']);

$maths11 = stripslashes($_POST['maths11']);
$english11 = stripslashes($_POST['english11']);
$english13 = stripslashes($_POST['english13']);
$science13 = stripslashes($_POST['science13']);
$maths133 = stripslashes($_POST['maths133']);
$maths132 = stripslashes($_POST['maths132']);

$address = stripslashes($_POST['address']);
$address2 = stripslashes($_POST['address2']);
$town = stripslashes($_POST['town']);
$county = stripslashes($_POST['county']);
$code = stripslashes($_POST['code']);
$tel = stripslashes($_POST['tel']);

//database connection

$query="UPDATE Promotions SET address='$address', address2='$address2', town='$town', county='$county', postcode='$code', tel='$tel' WHERE id = '$id'";
mysql_query($query) or die(mysql_error());


include 'confirm.php';
include 'registerEmail.php';
?>

有什么帮助吗?谢谢

最佳答案

而不是无用的 die ('Error updating database'); 以更多信息的方式处理你的错误

mysql_query($query) or trigger_error(mysql_error().' in '.$query);

阅读上面的内容

关于php - 使用 php 更新现有的 mysql 记录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5537353/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com