 |
ถามหน่อยน๊ะค่ะทำไม update ข้อมูล แล้วมันไม่เข้าในฐานข้อมูลคะ ? |
|
 |
|
|
 |
 |
|
โค้ดเก็บข้อมูลเข้า database
Code (PHP)
<?php
include ("chksession.php");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>แกไขข้อมูลส่วนตัว</title>
</head>
<h4 align="right"><?php echo "คุณเข้าสู่ระบบในชื่อ : <a href='show_member.php'>$sess_username</a>";?></h4>
<h4 align="right"><?php echo "<a href='logout.php'>ออกจากระบบ</a>";?></h4>
<h3><?php echo "แกไขข้อมูลส่วนตัว"; ?></h3>
<p> [<a href="main.php">หน้าหลัก</a>]
[<a href="show_member.php">ประวัติส่วนตัว</a>]<hr />
</p>
<?php
$user_edit=$_POST['user_edit'];
$fname_edit=$_POST['fname_edit'];
$lname_edit=$_POST['lname_edit'];
$email_edit=$_POST['email_edit'];
$add_edit=$_POST['add_edit'];
$phone_edit=$_POST['phone_edit'];
$pict_edit=$_POST['pict_edit'];
$date_edit=$_POST[date_edit];
include ("function.php");
if (!checkemail($email_edit)) {
echo "<h3>ERROR : รูปแบบอีเมลที่กรอกไม่ถูกต้องนะคะ</h3>";
exit();
}
include("connect.php");
$connect=mysql_connect("localhost","root","");
mysql_select_db("test_fu",$connect);
$result=mysql_query("update user set user_name='$user_edit',
user_fname='$fname_edit',
user_lname='$lname_edit',
user_email='$email_edit',
user_add='$add_edit',
user_tel='$phone_edit',
user_pict='$pict_edit',
user_date='$date_edit' where user_name='$sess_username'",$connect);
if ($result) {
echo "<h3>ข้อมูลของท่านถูกแก้ไขเรียบร้อยแล้ว</h3>";
} else {
echo "<h3>ไม่สามารถแก้ไขข้อมูลได้</h3>";
}
mysql_close();
?>
</body>
</html>
|
 |
 |
 |
 |
Date :
2012-09-08 23:46:29 |
By :
yah |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
เอา ,$connect ข้างหลังของ 2 บรรทัดนี้ออกครับ
Code
$result=mysql_query("select * from user where user_name='$sess_username'",$connect);
$result=mysql_query("update user set user_name='$user_edit',user_fname='$fname_edit',user_lname='$lname_edit',user_email='$email_edit',
user_add='$add_edit',user_tel='$phone_edit',user_pict='$pict_edit',user_date='$date_edit' where user_name='$sess_username'",$connect);
เป็น
Code (PHP)
$result=mysql_query("select * from user where user_name='$sess_username' ");
และ
Code (PHP)
$result=mysql_query("update user set user_name='$user_edit',user_fname='$fname_edit',user_lname='$lname_edit',user_email='$email_edit',
user_add='$add_edit',user_tel='$phone_edit',user_pict='$pict_edit',user_date='$date_edit' where user_name='$sess_username' ");
ถ้าส่งค่ามาถูกก็น่าจะทำงานได้แล้วครับ
|
 |
 |
 |
 |
Date :
2012-09-09 10:38:39 |
By :
arm8957 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ตอนนี้แก้ได้แล้วค่ะ ขอบคุณมาก ๆ น๊ะคะ
|
 |
 |
 |
 |
Date :
2012-09-10 21:51:24 |
By :
yah |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|