 |
มันไม่โชว์ข้อมูลอะและมันไม่จัดเก็บลงฐานข้อมูลด้วยอะคะ |
|
 |
|
|
 |
 |
|
คืออันแรกเลยครับ ผมว่านะ คุณลองเช็คตัวแปรคุณก่อนดีว่านะครับ ตัวแปรที่อยู่หน้าส่งข้อมูล จาก Textbox
อะ มันน่าจะดีกว่านะครับ แล้วก็ ลอง echo ดูว่า ค่ามาหรือป่าว นะครับ ต่อจากนั้นก็มาดูว่า sql ผิดหรือป่าวครับ ผมว่าถ้าไล่ code ประมาณนี้น่าจะเจอสาเหตุนะครับ ว่าทำไมถึงผิด ตอนนี้ผมว่าง่ายๆๆ ลองเช็คค่าที่ส่งมาก่อนว่ามาป่าว
ถ้าไม่มา ให้ปรับเปลี่ยน name ของ textbox นั้นใหม่ครับ ลองเช็คดูครับ
|
 |
 |
 |
 |
Date :
2010-08-01 18:24:17 |
By :
SOUL |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
Code (PHP)
$sql="SELECT * FROM `member` WHERE `user`='$user'"; //ตัวเดิม
$sql="SELECT * FROM member WHERE user='$user'"; //ตัวที่แก้ใข
Code (PHP)
$sql1="update `member` set name='$name',surname='$surname',position='$position',email='$email' where `user`='$user'";//ตัวเดิม
$sql1="update member set name='$name', surname='$surname', position='$position', email='$email' where user='$user'";//ตัวที่แก้ใข
ของดูนะครับ คิดว่านะ
|
 |
 |
 |
 |
Date :
2010-08-01 19:17:57 |
By :
mosaddzero |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
พี่ๆๆคะ ตอนนี้ข้อมูลไม่โชว์นู๋ลองกด ยืนยัน แล้วมันฟ้อง
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\AppServ\www\Asset_management\member\saveedit.php on line 15
อะคะ
$read1=mysql_fetch_array($qa); มันฟ้องมันนี้อะคะ รบกวนด้วยยยย
|
 |
 |
 |
 |
Date :
2010-08-01 19:40:44 |
By :
ผู้หญิงสีดำ |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ลองเอาไปใส่อีกทีครับ
แก้
Code (PHP)
$sqlquery=mysql_query($sql1);
$read=mysql_fetch_array($salquery);
เป็น
Code (PHP)
$sqlquery=mysql_query($sql1);
$read=mysql_fetch_array($sqlquery);
|
 |
 |
 |
 |
Date :
2010-08-01 20:59:33 |
By :
Mr.Poo |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
มันไม่ error แล้วนะแต่มันไม่เก็บค่าอะจ้า มันวิ่งกลับมาหน้าสมัครเหมือนเดิมอะ ไม่ยอมไปเก็บข้อมูลและวิ่งไปหน้า login อะจ้า
|
 |
 |
 |
 |
Date :
2010-08-01 21:20:09 |
By :
ผู้หญิงสีดำ |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
<?php @session_start();//เป็นคำสั่งเปิด session เพื่อดึงข้อมูลของ session มาตรวจสอบหรือเพิ่มข้อมูลเข้าไป
@include ('config.php');
$user=$_SESSION['txtuser'];
$pass=$_POST['txtpass'];
$sql="SELECT * FROM `member`";
$qa=mysql_query($sql);
//$read=mysql_fetch_array($qa);ติดตัวนีอีกตัวอะจ้ร
?>
อันนี้เป็นหน้าที่ออกแบบนะ แต่อันบนเปงอันเขียนโค้ดไม่มีออกแบบ
|
 |
 |
 |
 |
Date :
2010-08-01 21:21:42 |
By :
ผู้หญิงสีดำ |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
Code (PHP)
<?php
@session_start();
@include('config.php');
$user1=$_POST['txtuser'];
$pass=$_POST['txtpass'];
$enpass=$_POST['txtenpass'];
$name=$_POST['txtname'];
$surname=$_POST['txtsurname'];
$position=$_POST['txtposition'];
$email=$_POST['txtemail'];
$user=$_SESSION['txtuser'];//เก็บค่าของ section
//อยากใหคุณทดสอบหน่อย
echo "txtuser=$user1 <br>txtpass=$pass <br>txtenpassr=$enpass <br>txtname=$name <br>txtsurnamer=$surname <br>txtposition=$position <br>txtemail=$email";
/* ปิดการทำงานทังหมด
$sql="SELECT * FROM `member` WHERE `user`='$user'";
$qa=mysql_query($sql);
$read1=mysql_fetch_array($qa);
//$user=$read1['user'];
if($pass==$read1['pass'])
{
$sql1="update `member` set name='$name',surname='$surname',position='$position',email='$email' where `user`='$user'";
$sqlquery=mysql_query($sql1);
$read=mysql_fetch_array($salquery);
if($sqlquery==1)
{
echo"แก้ไขสมาชิกเรียบร้อยแล้ว";
echo"<meta http-equiv='refresh' content='2;URL=Intro.php' />";
}
else
{
echo"ผิดพลาด";
echo"<meta http-equiv='refresh' content='2;URL=member.php' />";
}
}
?>
ลองก็อปปี้ไปทดสอบดูนะว่า มันโชว์ครบทุกตัวไหม
|
ประวัติการแก้ไข 2010-08-02 03:10:13 2010-08-02 03:16:30 2010-08-02 03:27:56 2010-08-02 03:29:14
 |
 |
 |
 |
Date :
2010-08-02 03:08:05 |
By :
mosaddzero |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
Warning: Unterminated comment starting line 18 in C:\AppServ\www\Asset_management\member\saveedit.php on line 18
txtuser=
txtpass=
txtenpassr=
txtname=
txtsurnamer=
txtposition=
txtemail=
ผลออกมาเป็นแบบนี้อะคะ
|
 |
 |
 |
 |
Date :
2010-08-02 19:19:55 |
By :
ผู้หญิงสีดำ |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
เออแต่นุ๋จะบอกว่า ไอ้หน้าแก้ไขอะคะ นู๋เอาไว้ใน โฟรเดอร์ด้วยอะ คะ
|
 |
 |
 |
 |
Date :
2010-08-02 20:06:10 |
By :
ผู้หญิงสีดำ |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
Code (PHP)
<?php
@session_start();
@include('config.php');
$user1=$_POST['txtuser'];
$pass=$_POST['txtpass'];
$enpass=$_POST['txtenpass'];
$name=$_POST['txtname'];
$surname=$_POST['txtsurname'];
$position=$_POST['txtposition'];
$email=$_POST['txtemail'];
$user=$_SESSION['txtuser'];//เก็บค่าของ section
echo "txtuser=$user1 <br>txtpass=$pass <br>txtenpassr=$enpass <br>txtname=$name <br>txtsurnamer=$surname <br>txtposition=$position <br>txtemail=$email";
?>
ลองดูแค่นี้ก่อนครับ ถ้า รับค่าจาก POST มาแล้วแสดงค่าได้ ก็ค่อยเพิ่มส่วนบันทึกลงฐานข้อมูล
|
 |
 |
 |
 |
Date :
2010-08-02 23:23:24 |
By :
pob_suwan |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
<?php
session_start();
@include('../config.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>Untitled Document</title>
</head>
<body>
</body>
</html>
<?php
$user1=$_POST['txtuser'];
$pass=$_POST['txtpass'];
$enpass=$_POST['txtenpass'];
$name=$_POST['txtname'];
$surname=$_POST['txtsurname'];
$position=$_POST['txtposition'];
$email=$_POST['txtemail'];
$user=$_SESSION['txtuser'];//เก็บค่าของ section
// ปิดการทำงานทังหมด
$sql="SELECT * FROM `member` WHERE `user`='$user'";
$qa=mysql_query($sql);
$read=mysql_fetch_array($qa);
//$user=$read1['user'];
if($pass==$read['pass'])
{
$sql1="UPDATE `member` SET name='$name',surname='$surname',position='$position',email='$email' WHERE `user`='$user'";
$sqlquery=mysql_query($sql1);
if($sqlquery)
{
echo"แก้ไขสมาชิกเรียบร้อยแล้ว";
?>
<meta http-equiv="refresh" content="2;URL=../Intro.php">
<?php
}
else
{
echo"ผิดพลาด";
?>
<meta http-equiv="refresh" content="4;URL=editmember.php">
<?php
}
}
else
{
echo"password ผิดพลาด";
?>
<meta http-equiv="refresh" content="1;URL=editmember.php">
<?php
}
?>
รบกวนตรวจสอบให้หน่อยคะ ตอนนี้มันวิ่งแต่ password ผิดพลาดอะ แต่เช็คแล้ว password มันถูกอะ ขอบคุณคะ
|
 |
 |
 |
 |
Date :
2010-08-03 05:54:40 |
By :
ผู้หญิงสีดำ |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
อย่าลืมเช็คที่ sql ด้วยนะคะ สั่ง echo $sql ออกมาดู ว่าค่ามันถูกต้องไหม แล้วลองเอาไปรันในฐานข้อมูลดูว่า ได้ค่าออกมาจริงไหม
|
 |
 |
 |
 |
Date :
2010-08-03 08:40:10 |
By :
ultrasiam |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ตอนนี้มันติด update ทั้งหมดเลยอะคะ มันเปงเพราะไรว้าๆๆๆ
|
 |
 |
 |
 |
Date :
2010-08-03 12:46:41 |
By :
ผู้หญิงสีดำ |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
มเออคือว่า ตอนนี้มันไม่ยอมเก็บค่าใหม่เข้าไปอะ password ถูกแต่มันบอกว่า password ผิดพลาดอะจ้า มันผิดตรงไหนหรอ
|
 |
 |
 |
 |
Date :
2010-08-03 13:28:37 |
By :
ผู้หญิงสีดำ |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
$sql1="UPDATE `member` SET name='$name',surname='$surname',position='$position',email='$email' WHERE `user`='$user'";
// แสดง ภาษา SQL ที่ใช้ ก่อนครับ
echo $sql1;
// จากนั้น copy sql ที่ได้ ไป run ใน localhost แล้วดู error แล้วแก้ ไขครับ
|
 |
 |
 |
 |
Date :
2010-08-03 13:43:21 |
By :
noomry |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ขอบคุณคะพี่ช่วยตอบคำถาม ตอนนี้เจอแล้วมันติดตรง session
|
 |
 |
 |
 |
Date :
2010-08-03 15:58:40 |
By :
ผู้หญิงสีดำ |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|