 |
ตรวจสอบผู้แนะนำ Username SELECT * FROM `member` WHERE `Friend1` LIKE 'member' เขียนยังไงครับ |
|
 |
|
|
 |
 |
|
Code
<?
mysql_connect("localhost","root","root");
mysql_select_db("localhost");
if(trim($_POST["txtUpline"]) == "")
{
echo "Please input Upline!";
exit();
}
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["txtPin"]) == "")
{
echo "Please input Pin!";
exit();
}
if(trim($_POST["txtEmail"]) == "")
{
echo "Please input Pin!";
exit();
}
//
//คำสั่งค้นหาชื่อ Admin (Username) ของสมาชิก
//ตรวจสอบผู้แนะนำ Username SELECT * FROM `member` WHERE `Friend1` LIKE 'member'
//if(Friend1 LIKE 'member' Friend2 LIKE 'user' Friend3 LIKE 'test')
//{กรุณาเลือกผู้แนะนำใหม่ member , user , test
//}
//else(Username SELECT * FROM `member` WHERE `Friend1` LIKE 'member')
//Friend1 LIKE 'member' Friend2 LIKE 'user' Friend3 LIKE 'ว่าง')
//{สมัครเสร็จ Admin add Freind3 'ยูเซอร์ผู้สมัคร' , ยูเซอร์ผู้สมัคร add Invite 'Admin'
//}
//
//Cody Code PHP https://www.thaicreate.com/community/php-mysql-member-register-form.html
//โดยคุณ mr.win
//ขอบคุณครับ
//
$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 (Invite,Username,Password,Pin,Email) VALUES ('".$_POST["txtInvite"]."',
'".$_POST["txtUsername"]."','".$_POST["txtPassword"]."','".$_POST["txtPin"]."','".$_POST["txtEmail"]."')";
$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-09-10 20:53:10 |
By :
theslong |
View :
1261 |
Reply :
5 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ใช้พวก SUB SELECT หรือเปล่าครับ
|
 |
 |
 |
 |
Date :
2012-09-11 06:08:01 |
By :
mr.win |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ใช้ครับ ไม่เคยเห็นแนวทางของCode เลยไม่รู้วิธีทำครับ
ยกเว้น SELECT * FROM พอเข้าใจ
ขอบคุณครับ
|
 |
 |
 |
 |
Date :
2012-09-11 11:24:12 |
By :
theslong |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
พี่วินรบกวนแนะนำแนวทาง Code ให้หน่อยนะครับ
ขอบคุณครับ
|
 |
 |
 |
 |
Date :
2012-09-11 23:24:44 |
By :
theslong |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|

|
 |
 |
 |
 |
Date :
2012-09-12 08:57:41 |
By :
KT-Revenue |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|