试图更新现有的记录,但下面的代码似乎不起作用。

<?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);

读一下上面写的

10-07 15:59