Register Register Member Login Member Login Member Login Forgot Password ??
PHP , ASP , ASP.NET, VB.NET, C#, Java , jQuery , Android , iOS , Windows Phone
 

Registered : 109,027

HOME > PHP > PHP Forum > ขอถามข้อผิดพลาดว่าผิดตรงไหนถึงเข้าล็อกอินแล้วจะเข้าไปแก้ไขน่าจะมีข้อมูลของ User



 

ขอถามข้อผิดพลาดว่าผิดตรงไหนถึงเข้าล็อกอินแล้วจะเข้าไปแก้ไขน่าจะมีข้อมูลของ User

 



Topic : 030792



โพสกระทู้ ( 69 )
บทความ ( 0 )



สถานะออฟไลน์
Facebook



edit.php

<?php
include "chksession.php";
include "function.php";
include "connect.php";
$sql="select * from tb_meamber
where username='$sess_username' ";
$result=@mysql_db_query($dbname,$sql);
$result=@mysql_fetch_array($result);

$username=$record[username];
$name=$record[name];
$sex=$record[sex];
$email=$record[email];
$telephone=$record[telephone];
$address=$record[address];
$reg_date=$record[reg_date];
mysql_close();
?>
<html>
<head><title>Untitled Document</title><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head>
<body>
<h1>:: Edit Menber ::</h1>
<form method="post" action="edit2.php">
<table cellspacing="2">
<tr>
<td><b>Username : </b></td><td><?=$username?></td>
</tr>
<tr>
<td><b>ชื่อ -สกุล : </b></td><td><?=$name?></td>
</tr>
<tr>
<td><b>เพศ : </b></td><td><?=$sex?></td>
</tr>
<tr>
<td><b>อีเมล : </b></td>
<td><input name="email_edit" type="text"
value="<?=$email?>" size="26"> * </td>
</tr>
<tr>
<td><b>โทรศัพท์ : </b></td>
<td><input name="tel_edit" type="text"
value="<?=$telephone?>" size="26"></td>
</tr>
<tr>
<td valign="top"><b>ที่อยู่ติดต่อ :</b></td>
<td><textarea name="address_edit" cols="35"
rows="3"><?=$address?></textarea></td>
</tr>
<tr>
<td><b>สมัครเมื่อ :</b></td>
<td><?=displaydate($reg_date)?></td>
</tr>
<tr>
<td>&nbsp;</td>
<td><input type="submit" value="submit">
<input type="reset" value="reset"></td>
</tr>
</table>
</form>
[ <a href="main.php">กลับหน้าหลัก</a>]
</body>
</html>

edit.php

<head><meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<?php
include "chksession.php";
$email_edit=$_POST[email_edit];
$tel_edit=$_POST[tel_edit];
$address_edit=$_POST[address_edit];

include "function.php";
if (!checkemail($email_edit)) {
echo"<h3>ERROR : รูปแบบอีเมลที่กรอกไม่ถูกต้อง</h3>"; exit();
}
include "connect.php";
$sql="update tb_member set email='$email_edit',
telephone='$tel_edit' ,address='$address_edit',
where username='$sess_username' ";
$result=@mysql_db_query($dbname,$sql);
if ($result) {
echo "<h3>ข้อมูลของท่านถูกแก้ไขเรียบร้อยแล้ว</h3>";
echo "[<a href=main.php>กลับหน้าหลัก</a>]";
}else{
echo "<h3>ไม่สามารถแก้ไขข้อมูลได้</h3>";
}
mysql_close();
?>
</head>

changepw.php

<?php
include "chksession.php";
?>
<html>
<head><title>Untitled Document</title><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head>
<body>
<h1>:: Change Password ::</h1>
<form method="post" action="changepw2.php">
<table cellspacing="2">
<tr>
<td><b>Username : </b></td><td><?=$sess_username?>
</td>
</tr>
<tr>
<td><b>รหัสผ่านเดิม :</b></td><td><input name="oldpass"
type="password"> * </td>
</tr>
<tr>
<td><b>รหัสผ่านใหม่ : </b></td><td><input name="newpass"
type="password"> * </td>
</tr>
<tr>
<td><b>ยืนยันรหัสผ่านใหม่ : </b></td><td><input name="newpass2"
type="password"> * </td>
</tr>
<tr>
<td>&nbsp;</td>
<td><input type="submit" value="submit">
<input type="reset" value="reset"></td>
</tr>
</table>
</form>
[<a href="main.php">กลับหน้าหลัก</a>]
</body>
</html>

changepw2.php

<head><meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<?
include "chksession.php";
$oldpass=$_POST[oldpass];
$newpass=$_POST[newpass];
$newpass2=$_POST[newpass2];

if ($oldpass=="" or $newpass=="" or $newpass2=="" or
$newpass<>$newpass2) {
echo "<h3>ERROR: กรุณากรอกข้อมูลให้ครบ<h3>"; exit();
}
include "connect.php";
$sql="select * from tb_mamber where username='$sess_username'
and password='$lodpass' ";
$result=@mysql_db_query($dbname,$sql);
$num=@mysql_num_rows($result);
if ($num<1) {
echo "<h3>ERROR : รหัสผ่านเดิม ไม่ถูกต้อง<h3>"; exit();
}
$sql="update tb_member set password='$newpass'
where username='$sess_username'";
$result=@mysql_db_query($dbname,$sql);
if ($result) {
echo "<h3>เปลี่ยนรหัสผ่านเรียบร้อยแล้ว</h3>";
echo "[<a href=main.php >กลับหน้าหลัก</a>]";
} else {
echo "<h3>ไม่สามารถเปลี่ยนรหัสผ่าได้</h3>";
}
mysql_close();
?>
</head>


ดูให้หน่อยครับว่าผิดตรงไหนว่าทำไหมเข้าล็อกอินแล้วจะเข้าไปแก้ไขน่าจะมีข้อมูลของ User ออกมาว่าผิดตรงไหนบอกด้วยครับ++++++



Tag : - - - -







Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2009-08-26 06:20:27 By : topdkclub02 View : 881 Reply : 13
 

 

No. 1



โพสกระทู้ ( 11,835 )
บทความ ( 10 )

สมาชิกที่ใส่เสื้อไทยครีเอท Hall of Fame 2012

สถานะออฟไลน์


ลองเอา @ ออกจาก @mysql_ จะได้รู้ว่ามันผิดที่ไหน แบบนี้กว่าจะได้คำตอบต้องรอคนว่างๆ มานั่งอ่าน






Date : 2009-08-26 07:25:28 By : plakrim
 


 

No. 2



โพสกระทู้ ( 69 )
บทความ ( 0 )



สถานะออฟไลน์
Facebook

top

เป็นแบบนี้ครับแล้วผิดที่เดี๋ยวที่บอกแล้วข้อมูลยังไม่แสดงครับ แล้วใส่นี้เข้าไป @ ก็ไม่มีWarning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\AppServ\www\COM\edit.php on line 8 ไม่มีอันนี้ขึ้นมาครับแต่ไม่แสดงข้อมูลครับช่วยดูหน่อยครับที่กำลังว่างๆๆๆอยู่ครับขอบคุงงับ
Date : 2009-08-26 08:23:55 By : topdkclub02
 

 

No. 3



โพสกระทู้ ( 1,242 )
บทความ ( 13 )

สมาชิกที่ใส่เสื้อไทยครีเอท

สถานะออฟไลน์
Twitter Facebook

$sql="select * from tb_meamber where username='$sess_username' ";

$sess_username มาจากไหนเหรอครับ

ลองเช็คตัวแปรนี้ดูนะครับผมคิดว่ามันไม่มีค่าเลย query ไม่มีค่าไรออกมา
ถ้าคุณเก็บตัวนี้เป็น session การอ้างถึงควรใช้

$_SESSION['sess_username'];
Date : 2009-08-26 08:32:12 By : DownsTream
 


 

No. 4



โพสกระทู้ ( 69 )
บทความ ( 0 )



สถานะออฟไลน์
Facebook

หรือว่าผิดที่ตรงตัวนี้ครับ
function.php

<head><meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<?php
function displaydate($x){
$thai_m=array("Ҥ","Ҿѹ","չҤ","¹","Ҥ",
"Զع¹","áҤ","ԧҤ","ѹ¹","Ҥ","Ȩԡ¹","ѹҤ");
$date_array=explode("-",$x);
$y=$date_array[0];
$m=$date_array[1]-1;
$d=$date_array[2];

$m=$thai_m[$m];
$y=$y+543;

$displaydate="$d $m $y";
return $displaydate;
}
function checkemail($checkemail) {
if (ereg( "^[^@]+@([a-zA-Z0-9\-]+\.)+([a-zA-Z0-9\-]{2}
|net|com|gov|mil|org|edu|int)$",$checkemail ) ) {
return true;
} else {
return false;
}
}
?>
</head>

ช่วยดูหน่อยครับ
Date : 2009-08-26 08:33:34 By : topdkclub02
 


 

No. 5



โพสกระทู้ ( 1,242 )
บทความ ( 13 )

สมาชิกที่ใส่เสื้อไทยครีเอท

สถานะออฟไลน์
Twitter Facebook

error มันบอกว่า ไม่มี resourc ให้กับ function mysql_fetch_array() คือคุณ query ได้ค่าว่างอะครับ
ลองดูวิธีที่ผมบอกแล้วหรือยังครับ

ถ้าลองแล้วไม่ได้ก็ลอง echo คำสั่ง sql ออกมาแล้วนำไปรันใน phpmyadmin อะครับ
Date : 2009-08-26 08:56:57 By : DownsTream
 


 

No. 6



โพสกระทู้ ( 69 )
บทความ ( 0 )



สถานะออฟไลน์
Facebook

อันที่ดูแก้ได้ละครับตอนนี้ไม่มีข้อมูลขอกมาให้ดูครับ sess_username ตรงนี้ไปดูมาแล้ว มีครับมาจากหน้า Login ครับ
Date : 2009-08-26 09:55:02 By : topdkclub02
 


 

No. 7



โพสกระทู้ ( 69 )
บทความ ( 0 )



สถานะออฟไลน์
Facebook

ช่วยดูหน่อยครับ++++
Date : 2009-08-26 16:01:01 By : topdkclub02
 


 

No. 8



โพสกระทู้ ( 69 )
บทความ ( 0 )



สถานะออฟไลน์
Facebook

edit.php

<?php
include "chksession.php";
include "function.php";
include "connect.php";
$_SESSION['sess_username'];
$sql="select * from tb_meamber
where username='$sess_username' ";
$result=@mysql_db_query($dbname,$sql);
$result=@mysql_fetch_array($result);

$username=$record[username];
$name=$record[name];
$sex=$record[sex];
$email=$record[email];
$telephone=$record[telephone];
$address=$record[address];
$reg_date=$record[reg_date];
mysql_close();
?>
<html>
<head><title>Untitled Document</title><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head>
<body>
<h1>:: Edit Menber ::</h1>
<form method="post" action="edit2.php">
<table cellspacing="2">
<tr>
<td><b>Username : </b></td><td><?=$username?></td>
</tr>
<tr>
<td><b>ชื่อ -สกุล : </b></td><td><?=$name?></td>
</tr>
<tr>
<td><b>เพศ : </b></td><td><?=$sex?></td>
</tr>
<tr>
<td><b>อีเมล : </b></td>
<td><input name="email_edit" type="text"
value="<?=$email?>" size="26">
* </td>
</tr>
<tr>
<td><b>โทรศัพท์ : </b></td>
<td><input name="tel_edit" type="text"
value="<?=$telephone?>" size="26"></td>
</tr>
<tr>
<td valign="top"><b>ที่อยู่ติดต่อ :</b></td>
<td><textarea name="address_edit" cols="35"
rows="3"><?=$address?></textarea></td>
</tr>
<tr>
<td><b>สมัครเมื่อ :</b></td>
<td><?=displaydate($reg_date)?></td>
</tr>
<tr>
<td>&nbsp;</td>
<td><input type="submit" value="submit">
<input type="reset" value="reset"></td>
</tr>
</table>
</form>
[ <a href="main.php">กลับหน้าหลัก</a>]
</body>
</html>

edit2.php

<head><meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<?php
include "chksession.php";
$email_edit=$_POST[email_edit];
$tel_edit=$_POST[tel_edit];
$address_edit=$_POST[address_edit];

include "function.php";
if (!checkemail($email_edit)) {
echo"<h3>ERROR : รูปแบบอีเมลที่กรอกไม่ถูกต้อง</h3>"; exit();
}
include "connect.php";
$sql="update tb_member set email='$email_edit',
telephone='$tel_edit' ,address='$address_edit',
where username='$sess_username' ";
$result=@mysql_db_query($dbname,$sql);
if ($result) {
echo "<h3>ข้อมูลของท่านถูกแก้ไขเรียบร้อยแล้ว</h3>";
echo "[<a href=main.php>กลับหน้าหลัก</a>]";
}else{
echo "<h3>ไม่สามารถแก้ไขข้อมูลได้</h3>";
}
mysql_close();
?>
</head>
ลองแก้แล้วครับยังไม่ขึ้นเลยครับ
Date : 2009-08-26 21:35:29 By : topdkclub02
 


 

No. 9



โพสกระทู้ ( 69 )
บทความ ( 0 )



สถานะออฟไลน์
Facebook

ใส่ echo($sql); ก็แสดงว่า
select * from tb_meamber where username='topdkclub02'

ออกมาครับว่าทำไหมไม่แสดงค่าของusernameออกมา
Date : 2009-08-26 21:43:38 By : topdkclub02
 


 

No. 10



โพสกระทู้ ( 69 )
บทความ ( 0 )



สถานะออฟไลน์
Facebook

=ช่วยดูหน่อยครับ++++
Date : 2009-08-27 06:33:44 By : topdkclub02
 


 

No. 11

Guest


***===ช่วยหน่อยครับ==***
Date : 2009-08-27 08:54:42 By : topdkclub02
 


 

No. 12



โพสกระทู้ ( 11,835 )
บทความ ( 10 )

สมาชิกที่ใส่เสื้อไทยครีเอท Hall of Fame 2012

สถานะออฟไลน์


tb_meamber = tb_member?
Date : 2009-08-27 09:11:40 By : plakrim
 


 

No. 13



โพสกระทู้ ( 69 )
บทความ ( 0 )



สถานะออฟไลน์
Facebook

tb_meamber

เป็นที่เก็บฐานข้อมูลครับ
Date : 2009-08-27 12:36:48 By : topdkclub02
 

   

ค้นหาข้อมูล


   
 

แสดงความคิดเห็น
Re : ขอถามข้อผิดพลาดว่าผิดตรงไหนถึงเข้าล็อกอินแล้วจะเข้าไปแก้ไขน่าจะมีข้อมูลของ User
 
 
รายละเอียด
 
ตัวหนา ตัวเอียง ตัวขีดเส้นใต้ ตัวมีขีดกลาง| ตัวเรืองแสง ตัวมีเงา ตัวอักษรวิ่ง| จัดย่อหน้าอิสระ จัดย่อหน้าชิดซ้าย จัดย่อหน้ากึ่งกลาง จัดย่อหน้าชิดขวา| เส้นขวาง| ขนาดตัวอักษร แบบตัวอักษร
ใส่แฟลช ใส่รูป ใส่ไฮเปอร์ลิ้งค์ ใส่อีเมล์ ใส่ลิ้งค์ FTP| ใส่แถวของตาราง ใส่คอลัมน์ตาราง| ตัวยก ตัวห้อย ตัวพิมพ์ดีด| ใส่โค้ด ใส่การอ้างถึงคำพูด| ใส่ลีสต์
smiley for :lol: smiley for :ken: smiley for :D smiley for :) smiley for ;) smiley for :eek: smiley for :geek: smiley for :roll: smiley for :erm: smiley for :cool: smiley for :blank: smiley for :idea: smiley for :ehh: smiley for :aargh: smiley for :evil:
Insert PHP Code
Insert ASP Code
Insert VB.NET Code Insert C#.NET Code Insert JavaScript Code Insert C#.NET Code
Insert Java Code
Insert Android Code
Insert Objective-C Code
Insert XML Code
Insert SQL Code
Insert Code
เพื่อความเรียบร้อยของข้อความ ควรจัดรูปแบบให้พอดีกับขนาดของหน้าจอ เพื่อง่ายต่อการอ่านและสบายตา และตรวจสอบภาษาไทยให้ถูกต้อง

อัพโหลดแทรกรูปภาพ

Notice

เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ
อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง

   
  เพื่อความปลอดภัยและการตรวจสอบ กระทู้ที่แทรกไฟล์อัพโหลดไฟล์จากที่อื่น อาจจะถูกลบทิ้ง
 
โดย
อีเมล์
บวกค่าให้ถูก
<= ตัวเลขฮินดูอารบิก เช่น 123 (หรือล็อกอินเข้าระบบสมาชิกเพื่อไม่ต้องกรอก)







Exchange: นำเข้าสินค้าจากจีน, Taobao, เฟอร์นิเจอร์, ของพรีเมี่ยม, ร่ม, ปากกา, power bank, แฟลชไดร์ฟ, กระบอกน้ำ

Load balance : Server 02
ThaiCreate.Com Logo
© www.ThaiCreate.Com. 2003-2024 All Rights Reserved.
ไทยครีเอทบริการ จัดทำดูแลแก้ไข Web Application ทุกรูปแบบ (PHP, .Net Application, VB.Net, C#)
[Conditions Privacy Statement] ติดต่อโฆษณา 081-987-6107 อัตราราคา คลิกที่นี่