PDA

View Full Version : PHP - MySQL query output


moviemastersdk
04-19-2012, 07:19 PM
I am making a signup site for my game servers whitelist

i am useing phpbb on the website itself, and everytime someone signs up for the whitelist, i want the script, to check the phpbb_users mysql table for a match
here's what i made so far, doesn't seem to work, nothing happends :(

mysql_connect("localhost", "root", "yeah_you_wish") or die(mysql_error());
mysql_select_db("phpbb_db") or die(mysql_error());
$ign = $_POST["ign"];
$language = $_POST["country"];
$day = $_POST["day"];
$month = $_POST["month"];
$year = $_POST["year"];
$foundithow = $_POST["foundithow"];
$email = $_POST["email"];
$towny = $_POST["towny"];
$addinf = $_POST["addinf"];
$date_of_birth = $day . "-" . $month . "-" . $year;

$query = mysql_query("SELECT * FROM pending_signups WHERE ign='$ign'");
$forum_reg = mysql_query("SELECT username_clean from phpbb_users where username_clean ='$ign'");


if (mysql_num_rows($forum_reg) = 0)
{
header("Location: signup_error2.html");
}
elseif (mysql_num_rows($query) != 0)
{
header("Location: signup_error2.html");
}
else
{
mysql_query("INSERT INTO pending_signups (ign,language,born,found,email,towny,addinfo) VALUES('$ign','$language','$date_of_birth','$found ithow','$email','$towny','$addinf') ") ;
header("Location: signupdone.html");
}

edbr
04-20-2012, 02:30 AM
you are saying with this

if (mysql_num_rows($forum_reg) = 0)
{
header("Location: signup_error2.html");
}
elseif (mysql_num_rows($query) != 0)
{
header("Location: signup_error2.html");
}
if no result or if there is a result redirect to another page. try this
if (mysql_num_rows($forum_reg) > 0)
{
header("Location: signup_error2.html");
}

else
{
mysql_query("INSERT INTO pending_signups (ign,language,born,found,email,towny,addinfo) VALUES('$ign','$language','$date_of_birth','$found ithow','$email','$towny','$addinf') ") ;
header("Location: signupdone.html");

moviemastersdk
04-20-2012, 07:50 AM
But now it only checks for the forum_reg, and not the query?

edbr
04-20-2012, 09:16 AM
Sorry My mistake I misread it.