guyz我在我的php项目中有这个查询,我不知道它有什么问题可以帮助
$first_name = $_POST['first_name'];
$middle_name = $_POST['middle_name'];
$last_name = $_POST['last_name'];
$telephone = $_POST['telephone'];
$date_of_birth = $_POST['date_of_birth'];
$number = $_POST['number'];
mysql_connect('domain','username','password');
mysql_select_db('db name');
$query="UPDATE scout_cabs SET first_name = '$first_name' , middle_name = '$middle_name' , last_name = '$last_name' , telephone = '$telephone' , date_of_birth = '$date_of_birth' WHERE number = '$number'";
mysql_query($query);
mysql_close();
答案 0 :(得分:0)
检查变量是否设置。如果变量为空,则查询将不起作用。
//something like
$first_name = isset($_POST['first_name'])?$_POST['first_name']:NULL;
//other variables as well
如果它不起作用,请在 mysql 中检查您的查询 一些建议使用 mysqli 而不是 mysql