|
|
|
mysql_num_rows(): supplied argument is not a valid MySQL result resource แก้ยังไง |
|
|
|
|
|
|
|
Code (PHP)
<?
$username_reg=$_POST[username_reg];
$password_reg=$_POST[password_reg];
$name_reg=$_POST[name_reg];
$sex_reg=$_POST[sex_reg];
$email_reg=$_POST[email_reg];
$telphone_reg=$_POST[telephone_reg];
$address_reg=$_POST[address_reg];
$date_reg=date("Y-m-d");
if ($username_reg=="" or $password_reg=="" or $name_reg=="" ) {
echo "<h3>ERROR : ¡ÃسҡÃÍ¡¢éÍÁÙÅãËé¤Ãº¹Ð¤ÃѺ<h3>"; exit();
}
include "function.php";
if (!checkemail($email_reg)) {
echo "<h3>ERROR : ÃٻẺÍÕàÁÅ·Õè¡ÃÍ¡äÁè¶Ù¡µéͧ¹Ð¤ÃѺ </h3>"; exit();
}
include "connect.php";
$sql="select * from tb_member where username='$user_reg' ";
$result=mysql_db_query($dbname,$sql);
$num=mysql_num_rows($result) or die(mysql_error());
if($num>0) {
echo "<h3>ERROR : Username «éÓ¤ÃѺ </h3>"; exit();
}
$sql="insert into tb_member
values(','$username_reg','$password_reg','$name_reg','$sex_reg','$email_reg','$telephone_reg','$address_reg','$date_reg')";
$result=mysql_db_query($dbname,$sql);
if ($result) {
echo "<h3>¢éÍÁÙŢͧ·èÒ¹¶Ù¡ºÑ¹·Ö¡àÃÕºÃéÍÂáÅéÇ</h3>";
echo "<A HREF='index.html'>¤ÅÔ¡à¾×èÍà¢éÒÃкºÊÁÒªÔ¡</A><BR><BR>";
} else {
echo "<h3>äÁèÊÒÁÒöÊÁѤÃà»ç¹ÊÁÒªÔ¡ä´é</h3>";
}
mysql_close();
?>
Tag : PHP, MySQL
|
|
|
|
|
|
Date :
2015-10-15 21:43:04 |
By :
jirayuz |
View :
747 |
Reply :
1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Code (PHP)
$result=mysql_db_query($dbname,$sql) or die(mysql_error());
มันน่าจะมี error ครับ
|
|
|
|
|
Date :
2015-10-15 22:02:13 |
By :
mr.win |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 00
|