|
|
|
!!!!!!!!!! รบกวนชื่อดูหน่อยคับ Warning: mysql_fetch_array() |
|
|
|
|
|
|
|
มันเกิด
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\AppServ\www\exotic\insert.php on line 31
Code (PHP)
<?
mysql_connect("localhost","root","1234");
mysql_select_db("exo");
if(trim($_POST["txtUsername"]) == "")
{
echo "Please input Username!";
exit();
}
if(trim($_POST["txtPassword"]) == "")
{
echo "Please input Password!";
exit();
}
if($_POST["txtPassword"] != $_POST["txtConPassword"])
{
echo "Password not Match!";
exit();
}
if(trim($_POST["txtidcard"]) == "")
{
echo "Please input Name!";
exit();
}
$strSQL = "SELECT * FROM member WHERE Username = '".trim($_POST['txtUsername'])."' ";
$objQuery = mysql_query($strSQL);
$objResult = mysql_fetch_array($objQuery);
if($objResult)
{
echo "Username already exists!";
}
else
{
$strSQL = "INSERT INTO member (name,extension,idcard,sex,phone,username,password,repassword,email,birthday,Status) VALUES ('".$_POST["txtname"]."',
'".$_POST["txtextension"]."','".$_POST["txtidcard"]."','".$_POST["txtsex"]."','".$_POST["txtphone"]."','".$_POST["txtUsername"]."',
'".$_POST["txtpassword"]."','".$_POST["txtConPassword"]."','".$_POST["txtemail"]."','".$_POST["txtbirthday"]."','".$_POST["ddlStatus"]."')";
$objQuery = mysql_query($strSQL);
echo "Register Completed!<br>";
echo "<br> Go to <a href='login.php'>Login page</a>";
}
mysql_close();
?>
Tag : PHP, MySQL
|
|
|
|
|
|
Date :
2012-04-05 22:46:40 |
By :
nukedonut1 |
View :
920 |
Reply :
4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ลอง echo ข้อมูลดูก่อนครับว่ามีหรือเปล่า
|
|
|
|
|
Date :
2012-04-05 23:24:58 |
By :
kooyarut |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
รบกวนขอวิธีทำด้วยได้ไหมคับ
|
|
|
|
|
Date :
2012-04-05 23:47:42 |
By :
nukedonut1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ดันๆๆๆๆๆๆๆๆๆๆๆๆๆๆๆๆๆๆๆๆ
|
|
|
|
|
Date :
2012-04-06 00:40:16 |
By :
nukedonut1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Code (PHP)
echo $strSQL = "SELECT * FROM member WHERE Username = '".trim($_POST['txtUsername'])."' ";
ออกมาก่อนนะครับ แล้วนำผลลัพธ์ที่ได้ ลองไปว่างที่ Database ดูสิครับ ถ้ามัน Error แสดงว่าผิดครับ
|
|
|
|
|
Date :
2012-04-06 00:46:58 |
By :
thethaicom |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 01
|