 |
ใครรู้ช่วยแก้ mysql_num_rows : Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in |
|
 |
|
|
 |
 |
|
บรรทัดที่ 3 $num = mysql_num_rows($result) ; อย่างนี้ช่ายไหม
ให้ลอง check filed ข้อมูลว่าถูกหรือเปล่า
ทำไม ไม่ select * from membertb where email = '$email' and password = '$password'
อย่างนี้ล่ะครับ
|
 |
 |
 |
 |
Date :
2009-11-09 11:24:19 |
By :
First |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ทำแล้วคับ เหมือนเดิมอะ คับ
|
 |
 |
 |
 |
Date :
2009-11-09 11:28:13 |
By :
pissanu101 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ผมแนะนำการเขียนแบบนี้นะครับลองเอาไปใช้ดู เพราะที่ error อาจจะเป้นเพราะ Query ไม่ถูกครับ
$strSQL = "select email,password from membertb where email='$email' and password='$password'";
$objQuery = mysql_query($strSQL)or die("error query [ $strSQL ]"); ** บันทัดนี้จะช่วยให้เราตรวจสอบการคิวรี่ของเราถูกต้องไหมครับ
$num = mysql_num_rows($objQuery) ;
|
 |
 |
 |
 |
Date :
2009-11-09 13:45:16 |
By :
cyberboy |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
$objQuery = mysql_query($strSQL)or die(mysql_error()."<br>SQL : ".$strSQL); แบบนี้เห็นชัดกว่า
|
 |
 |
 |
 |
Date :
2009-11-09 14:05:16 |
By :
plakrim |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
<?
$username=$_POST['user'];
$pass=$_POST['pass'];
$repass=$_POST['repas'];
$prefix=$_POST['prefix'];
$name=$_POST['name'];
$surname=$_POST['surname'];
$email=$_POST['email'];
$gender=$_POST['gender'];
$date=$_POST['birth_date'];
$home=$_POST['home_number'];
$moo=$_POST['Moo'];
$district=$_POST['District'];
$aumper=$_POST['Aum'];
$province=$_POST['Province'];
$zipcode=$_POST['postcode'];
$telephone=$_POST['telephone'];
$fax=$_POST['fax'];
if ($username=="" || $pass=="" || $repass=="" || $prefix=="" || $name=="" || $surname=="" || $email=="" || $gender=="" || $home=="" || $moo=="" || $district== "" || $aumper =="" || $province=="" || $zipcode=="" || $telephone=="" ) {
echo "<h3>ERROR : กรุณากรอกข้อมูลให้ครบค่ะ <h3>"; exit();
}
include "function.php";
if (!checkemail($email)) {
echo "<h3>ERROR : รูปแบบอีเมล์ไม่ถูกต้องค่ะ </h3>";
//exit()
}
/*if(!checktel($tel)){
echo "<h3>ERROR : ÃٻẺàºÍÃìâ·ÃÈѾ·ì·Õè¡ÃÍ¡äÁè¶Ù¡µéͧ¤èÐ</h3>"; exit();
}*/
include "connect.php";
$sql="select * from member where username='$user'";
$result= mysql_db_query($dbname,$sql);
$num = mysql_num_rows($result)or die(mysql_error()); ;
mysql_close();
if($num > 0) {
echo "<h3>ERROR : Username ซ้ำ </h3>"; exit();
}
$sql= "insert into member Value ('','$uer','$pass','$repass','$prefix','$name','$surname','$email','$gender','birth_date','$home_number','Moo','$District','$Province','$Postcode','telephonel','fax')";
$result= mysql_db_query($dbname ,$sql);
if ($result) {
echo "<h3>¢éÍÁÙŢͧ·èÒ¹¶Ù¡ºÑ¹·Ö¡àÃÕºÃéÍÂáÅéÇ</h3>";
echo "<A HREF='home.php'>¤ÅÔ¡à¾×èÍà¢éÒÃкºÊÁÒªÔ¡</A><BR><BR>";
} else {
echo "<h3>äÁèÊÒÁÒöÊÁѤÃà»ç¹ÊÁÒªÔ¡ä´é</h3>";
}
mysql_close();
?>
|
 |
 |
 |
 |
Date :
2010-01-10 19:40:31 |
By :
Nongnoo |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
<?
$username=$_POST['user'];
$pass=$_POST['pass'];
$repass=$_POST['repas'];
$prefix=$_POST['prefix'];
$name=$_POST['name'];
$surname=$_POST['surname'];
$email=$_POST['email'];
$gender=$_POST['gender'];
$date=$_POST['birth_date'];
$home=$_POST['home_number'];
$moo=$_POST['Moo'];
$district=$_POST['District'];
$aumper=$_POST['Aum'];
$province=$_POST['Province'];
$zipcode=$_POST['postcode'];
$telephone=$_POST['telephone'];
$fax=$_POST['fax'];
if ($username=="" || $pass=="" || $repass=="" || $prefix=="" || $name=="" || $surname=="" || $email=="" || $gender=="" || $home=="" || $moo=="" || $district== "" || $aumper =="" || $province=="" || $zipcode=="" || $telephone=="" ) {
echo "<h3>ERROR : กรุณากรอกข้อมูลให้ครบค่ะ <h3>"; exit();
}
include "function.php";
if (!checkemail($email)) {
echo "<h3>ERROR : รูปแบบอีเมล์ไม่ถูกต้องค่ะ </h3>";
//exit()
}
/*if(!checktel($tel)){
echo "<h3>ERROR : ÃٻẺàºÍÃìâ·ÃÈѾ·ì·Õè¡ÃÍ¡äÁè¶Ù¡µéͧ¤èÐ</h3>"; exit();
}*/
include "connect.php";
$sql="select * from member where username='$user'";
$result= mysql_db_query($dbname,$sql);
$num = mysql_num_rows($result)or die(mysql_error()); ;
mysql_close();
if($num > 0) {
echo "<h3>ERROR : Username ซ้ำ </h3>"; exit();
}
$sql= "insert into member Value ('','$uer','$pass','$repass','$prefix','$name','$surname','$email','$gender','birth_date','$home_number','Moo','$District','$Province','$Postcode','telephonel','fax')";
$result= mysql_db_query($dbname ,$sql);
if ($result) {
echo "<h3>¢éÍÁÙŢͧ·èÒ¹¶Ù¡ºÑ¹·Ö¡àÃÕºÃéÍÂáÅéÇ</h3>";
echo "<A HREF='home.php'>¤ÅÔ¡à¾×èÍà¢éÒÃкºÊÁÒªÔ¡</A><BR><BR>";
} else {
echo "<h3>äÁèÊÒÁÒöÊÁѤÃà»ç¹ÊÁÒªÔ¡ä´é</h3>";
}
mysql_close();
?>
ERROR : กรุณากรอกข้อมูลให้ครบค่ะ ไม่รู้จะแก้ตรงไหนดี
แก้ไม่ถูกแล้วค่ะ ช่วยหน่อยน่ะค่ะ ส่วนอีที่หนึ่ง
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in C:\AppServ\www\BanCake\member2.php on line 36
Unknown column 'username' in 'where clause'
ไม่รู้จะแก้ยังงัยดีช่วยหน่อยน่ะค่ะ ขอบพระคุณเป็นอย่างยิ่งค่ะ
|
 |
 |
 |
 |
Date :
2010-01-10 20:02:43 |
By :
Nongnoo |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
('','$uer','$pass','$repass','$prefix','$name','$surname','$email','$gender','birth_date','$home_number','Moo','$District','$Province','$Postcode','telephonel','fax')";
'$uer',$repass'$Aumหายไปใหน[color=re$Postcode',d][/color]'telephonel',
ตัวที่ถูก[('','$user','$pass','$repas','$prefix','$name','$surname','$email','$gender','birth_date','$home_number','Moo','$District','$Aum','$Province','$postcode','telephone','fax')";
|
 |
 |
 |
 |
Date :
2010-01-11 00:12:07 |
By :
parita |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|