|
|
|
รบกวนทีค้าบบบบบ การแก้ไขข้อมูลใน mysql ทำมาแล้วมันไม่ยอมแก้ผู้รู้ช่วยดูให้ทีคับ |
|
|
|
|
|
|
|
เอา code มาวางง่ายกว่าครับ
|
|
|
|
|
Date :
2013-03-06 21:17:53 |
By :
mangkunzo |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
อันนี้ EDIT_PROFILE นะคับ
Code (PHP)
<?
session_start();
if($_SESSION['MId'] == "")
{
echo "Please Login!";
exit();
}
mysql_connect("localhost","root","root");
mysql_select_db("webboard");
$strSQL = "SELECT * FROM tbl_member WHERE MId = '".$_SESSION['MId']."' ";
$objQuery = mysql_query($strSQL);
$objResult = mysql_fetch_array($objQuery);
?>
<html>
<head>
<title>ThaiCreate.Com Tutorials</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head>
<body>
<form name="form1" method="post" action="save_profile.php">
Edit Profile! <br>
<table width="400" border="1" style="width: 400px">
<tbody>
<tr>
<td width="125"> Username</td>
<td width="180">
<?=$objResult["MId"];?> </td>
</tr>
<tr>
<td> Name</td>
<td><input name="txtName" type="text" id="txtName" value="<?=$objResult["MName"];?>"></td>
</tr>
<tr>
<td>Lastname </td>
<td><input name="txtName2" type="text" id="txtName2" value="<?=$objResult["MLastname"];?>"></td>
</tr>
<tr>
<td>Password </td>
<td><input name="MPass" type="password" id="MPass" value="<?=$objResult["MPass"];?>"></td>
</tr>
<tr>
<td>Address</td>
<td><label>
<input name="MEmail2" type="text" id="MEmail2" value="<?=$objResult["MAddress"];?>
">
</label></td>
</tr>
<tr>
<td> Email</td>
<td><input name="MEmail" type="text" id="MEmail" value="<?=$objResult["MEmail"];?>
"></td>
</tr>
</tbody>
</table>
<br>
<input type="submit" name="Submit" value="Save">
</form>
</body>
</html>
อันนี้ save_profile นะคับ
Code (PHP)
<?
session_start();
if($_SESSION['MId'] == "")
{
echo "Please Login!";
exit();
}
mysql_connect("localhost","root","root");
mysql_select_db("webboard");
$strSQL = "UPDATE tbl_member SET MPass = '".trim($_POST['MPass'])."'MName = '".trim($_POST['MName'])."'WHERE MId = '".$_SESSION["MId"]."' ";
$objQuery = mysql_query($strSQL);
echo "Save Completed!<br>";
if($_SESSION["MLevel"] == "9000")
{
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 :
2013-03-06 21:20:08 |
By :
bmza9999 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 05
|