|
 |
|
ช่วยรบกวนผู้รู้ดูให้หน่อยครับ สคริป แก้ไขข้อมูลสมาชิก สวัสดีครับ พอดีเป็นมือใหม่หัดเขียน PHP พอดีมีปัญหาเกี่ยวกับ สคริป Edit_Profie |
|
 |
|
|
 |
 |
|
คุณใส่ผิดช่อง ผิดตัวแปรครับ กลับไปดูบทความอีกครั้งให้ล่ะเอียดครับ
Code (PHP)
<?
session_start();
if($_SESSION['UserID'] == "")
{
echo "Please Login!";
exit();
}
mysql_connect("localhost","root","root");
mysql_select_db("mydatabase");
if($_POST["txtPassword"] != $_POST["txtConPassword"])
{
echo "Password not Match!";
exit();
}
$strSQL = "UPDATE member SET Username = '".trim($_POST['txtPassword'])."'
,Name = '".trim($_POST['txtName'])."' WHERE UserID = '".$_SESSION["UserID"]."' ";
$objQuery = mysql_query($strSQL);
echo "Save Completed!<br>";
if($_SESSION["Status"] == "ADMIN")
{
echo "<br> Go to <a href='admin_page.php'>Admin page</a>";
}
else
{
echo "<br> Go to <a href='user_page.php'>User page</a>";
}
mysql_close();
?>
Go to : PHP MySQL กับ Login Form ทำระบบ User ล็อกอิน แบบง่าย ๆ ด้วย PHP และ MySQL โดยทำการตรวจสอบ Username และ Password
|
 |
 |
 |
 |
Date :
2011-06-10 08:59:59 |
By :
webmaster |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
Code (PHP)
<?
session_start();
if($_SESSION['UserID'] == "")
{
echo "Please Login!";
exit();
}
mysql_connect("localhost","root","123456");
mysql_select_db("account");
if($_POST["txtPassword"] != $_POST["txtConPassword"])
{
echo "Password not Match!";
exit();
}
$strSQL = "UPDATE member SET Username = '".trim($_POST['txtPassword'])."'
,Name = '".trim($_POST['txtName'])."' WHERE UserID = '".$_SESSION["UserID"]."' ";
$objQuery = mysql_query($strSQL);
echo "Save Completed!<br>";
if($_SESSION["Status"] == "ADMIN")
{
echo "<br> Go to <a href='admin_page.php'>Admin page</a>";
}
else
{
echo "<br> Go to <a href='user_page.php'>User page</a>";
}
mysql_close();
?>
มันก็ถูกนะคับ
แต่มันยังไม่ได้เลย
|
 |
 |
 |
 |
Date :
2011-06-10 13:05:56 |
By :
golfgto |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ไม่รู้ว่าทำได้หรือยังนะครับ ผมก็เป็นเหมือนกัน แต่แก้ได้แล้วครับ เลยมาบอกเพื่อเป็นความรู้ให้คนอื่นแล้วกัน ให้เปิดไฟล์ save_profile.php ครับ แล้วเพิ่ม '".trim($_POST['txtUsername'])."' ลงไป ตามโค้ดด้านล่างนี้นะครับ
Code (PHP)
$strSQL = "UPDATE member SET Username = '".trim($_POST['txtUsername'])."', '".trim($_POST['txtPassword'])."'
,Name = '".trim($_POST['txtName'])."' WHERE UserID = '".$_SESSION["UserID"]."' ";
$objQuery = mysql_query($strSQL);
โอ๊ะ!! แต่ลองแล้วเกิดปัญหาเลยครับ คราวนี้ Password ไม่เปลี่ยน
|
ประวัติการแก้ไข 2011-07-09 22:59:54
 |
 |
 |
 |
Date :
2011-07-08 15:48:12 |
By :
Pongfanclub |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 05
|