请帮帮我,我不知道实际的错误意味着什么,但我正在寻找任何方法来使这项工作!请!
<?php
//session_start();
include("config.php");
include("auth.php");
if($_SESSION['SESS_MEMBER_ID'] != 'true') {
// header("location:member-index.php");
}
//connects to database
$link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD);
if (!$link) {
die("Failed to connect to server: " . mysql_error());
}
//selects database
$db = mysql_select_db(DB_DATABASE);
if (!$db) {
die ("Unable to select database");
}
这是错误的地方
$qry = "UPDATE members set firstname="'.$firstname.'", lastname="'.$lastname.'", location="'.$location.'", email="'.$email.'", cell_number="'.$cell_number.'", home_number="'.$home_number.'", about="'.$about.'" where member_id="'.$_SESSION['SESS_MEMBER_ID'].'" "
$result = @mysql_query($qry);
?>
答案 0 :(得分:1)
更改
$qry = "UPDATE members set firstname="'.$firstname.'", lastname="'.$lastname.'", location="'.$location.'", email="'.$email.'", cell_number="'.$cell_number.'", home_number="'.$home_number.'", about="'.$about.'" where member_id="'.$_SESSION['SESS_MEMBER_ID'].'" "
到
$qry = "UPDATE members set firstname='".$firstname."', lastname='".$lastname."', location='".$location."', email='".$email."', cell_number='".$cell_number."', home_number='".$home_number."', about='".$about."' where member_id='".$_SESSION['SESS_MEMBER_ID']."' ";
注意:强烈建议使用Prepared语句而不是使用mysql_ *函数。