请帮忙。。我放弃了。。
试图更新MySql表..文件是settings.php(自行提交)表单代码是:
<form method="POST" action="settings.php">
First Name <input type="text" name="fname" id="set_fname" />
Last name <input type="text" name="lname" id="set_lname" />
Email: <input type="text" name="email" id="set_email" />
mobile <input type="text" name="mobile" id="set_mobile" />
Bio: <textarea name="bio" id="set_bio" cols="" rows="5" maxlength="1000" ></textarea>
<input type="submit" id="personal_submit" value="Update" />
</form>
php部分
$id=$_SESSION['id'];
$fname_update =$_POST['fname'];
$lnam_update = $_POST['lname'];
$email_update = $_POST['email'];
$mobile_update =$_POST['mobile'];
$bio_update =$_POST['bio'];
$db_host="localhost";
$db_uname="admin";
$db_pass="mypass";
$db_db="main_db";
$db_table="mebers_general";
mysql_connect("$db_host","$db_uname","$db_pass") or die (mysql_error());
mysql_select_db("$db_db") or die("no database by that name");
if($_POST['fname']){
$sql_personal_update=mysql_query("UPDATE members_general SET first_name='$fname_update' WHERE id='$id' ") or die (mysql_error()) ;
if($sql_personal_update){
echo "should be ok but no record is updated....Heeelppp";
}else{
echo "Smth is Wrong";
}
}
我没有错误..
结果我得到了回显字符串“应该没问题,但没有更新记录....Heeelppp”;所以它检测到更新没有问题我在 phpMyadmin 中尝试了相同的查询 - 工作得很好。我检查了变量-它们不是空的..一切似乎都应该如此。请帮忙..在这里已经堆了 2 天//