Jump to content

[SOLVED] php register page error


chris_rulez001

Recommended Posts

hi, can someone help me here?

 

when i click register and it goes to the next page it says "Query Was Empty"

 

why is it doing that?

 

my register code:

 

mysql_connect("$host1", "$username1", "$password1")or die("cannot connect");
mysql_select_db("$db_name1")or die("cannot select DB");

$sqlb="SELECT * FROM boardsetting WHERE action='boardactive'";
// OREDER BY id DESC is order result by descending
$resultb=mysql_query($sqlb);

$boardsetting = mysql_fetch_array($resultb);

$name = $_POST['name'];
$day = $_POST['day'];
$month = $_POST['month'];
$year = $_POST['year'];
$age = $day."/".$month."/".$year;
$email = $_POST['email'];
$username = $_POST['username'];
$md5pass = md5(trim($password));
$password = $_POST['password'];
$passwordconfirm = $_POST['passwordconfirm'];
$securitynumber = $_POST['securitynumber'];
$securitynumberconfirm = $_POST['securitynumberconfirm'];
$securityquestion = $_POST['securityquestion'];
$securityanswer = $_POST['securityanswer'];
$date = date("l F d, g i a");
$ip = $_SERVER['REMOTE_ADDR'];
$emailsetting = $_POST['emailsetting'];
$agesetting = $_POST['agesetting'];
$onlinesetting = $_POST['onlinesetting'];
$pmsetting = $_POST['pmsetting'];

echo "<table width='92%' cellspacing='0' cellpadding='0' align='center'>
  <tr>
    <td valign='top' width='100%'>
      <br />
<a href='index.php' class='nav'>".$rows4['forumtitle']."</a> --> ";

if ($action == "") 
{ 
echo "Home"; 
} 
else if ($action == "view_profile")
  { 
  echo "View Profile";
   } 
   else if ($action == "help")
    { 
echo "Help"; 
}
else if ($action == "members")
    { 
echo "Members"; 
}
else if ($action == "login")
    { 
echo "Login"; 
}
else if ($action == "register")
    { 
echo "Register"; 
}
else if ($action == "register2")
    { 
echo "Register"; 
}
else if ($action == "logout")
    { 
echo "Logout"; 
}
else if ($action == "admin")
    { 
echo "Administration Panel"; 
}
else if ($boardsetting['setting'] == 0)
{
echo "Forum Unavailable";
}
   else 
   { 
   echo "";
    } 

if ($boardsetting['setting'] == 0)
{
echo "<br/><br/>
<table border='0' width='100%' cellspacing='0' cellpadding='0'>
<tr>
<td>
<table cellpadding='4' cellspacing='1' border='0' width='100%'>";

echo "<tr>
<td class='catbg' bgcolor='DADADA' height='18'>
Sorry, This Forum Is Currently Unavailable Due To Maintainence.<br/><br/>
Sorry For Any Inconnvience Caused.<br/><br/>
Admin Team.
</td>";

echo "</table><br/><br/>";
}
else
{	
echo "<br/><br/>
<table border='0' width='100%' cellspacing='0' cellpadding='0'>
<tr>
<td>
<table cellpadding='4' cellspacing='1' border='0' width='100%'>
<tr>
<td style='background-color:DADADA' colspan='2'>
<font color='0000' size='-1'><b>Register</b></font></td>
</tr>";

echo "<tr>
<td class='catbg' bgcolor='DADADA' height='18'>";

if (htmlentities(empty($name), ENT_QUOTES))
{
echo "You havent filled all the required fields<br/><br/><a href='javascript:history.go(-1)'>Go Back</a>";
}
else if ($day == 0)
{
echo "You havent filled all the required fields<br/><br/><a href='javascript:history.go(-1)'>Go Back</a>";
}
else if ($month == 0)
{
echo "You havent filled all the required fields<br/><br/><a href='javascript:history.go(-1)'>Go Back</a>";
}
else if ($year == 0)
{
echo "You havent filled all the required fields<br/><br/><a href='javascript:history.go(-1)'>Go Back</a>";
}
else if (htmlentities(empty($username), ENT_QUOTES))
{
echo "You havent filled all the required fields<br/><br/><a href='javascript:history.go(-1)'>Go Back</a>";
}
else if (htmlentities(empty($password), ENT_QUOTES))
{
echo "You havent filled all the required fields<br/><br/><a href='javascript:history.go(-1)'>Go Back</a>";
}
else if (htmlentities(empty($passwordconfirm), ENT_QUOTES))
{
echo "You havent filled all the required fields<br/><br/><a href='javascript:history.go(-1)'>Go Back</a>";
}
else if (htmlentities(empty($email) || strpos($email, "@") == FALSE || strpos($email, ".") == FALSE, ENT_QUOTES))
{
echo "You havent filled all the required fields<br/><br/><a href='javascript:history.go(-1)'>Go Back</a>";
}
else if (htmlentities(empty($securitynumber), ENT_QUOTES))
{
echo "You havent filled all the required fields<br/><br/><a href='javascript:history.go(-1)'>Go Back</a>";
}
else if (htmlentities(empty($securitynumberconfirm), ENT_QUOTES))
{
echo "You havent filled all the required fields<br/><br/><a href='javascript:history.go(-1)'>Go Back</a>";
}
else if (htmlentities(empty($name), ENT_QUOTES))
{
echo "You havent filled all the required fields<br/><br/><a href='javascript:history.go(-1)'>Go Back</a>";
}
else if (htmlentities(strpos($passwordconfirm, $password) === false))
{
echo "Password and Password Confirm do not match<br/><br/><a href='javascript:history.go(-1)'>Go Back</a>";
}
else if (htmlentities(strpos($securitynumberconfirm, $securitynumber) === false))
{
echo "Security Number and Security Number Confirm do not match<br/><br/><a href='javascript:history.go(-1)'>Go Back</a>";
}
else
{
mysql_connect("$host1", "$username1", "$password1")or die("cannot connect");
mysql_select_db("$db_name1")or die("cannot select DB");

$addusers = "INSERT INTO forumusers(id, username, password, email, age, gender, name, securitynumber, securityquestion, securityanswer, emailsetting, agesetting, onlinesetting, pmsetting, dateregistered, ip)VALUES('$id', '$username', '$md5pass', '$email', '', '$gender', '$name', '$securitynumber', '$securityquestion', '$securityanswer', '$emailsetting', '$agesetting', '$onlinesetting', '$pmsetting', '$dateregistered', '$ip')";

$inserted = mysql_query($sql_user_check) OR DIE(mysql_error());

if ($inserted){
echo "Your Login Details
<hr>
Username: ".$username."<br/><br/>
Password: ".$password."<br/><br/><br/>
Security Details
<hr>
Security Number: ".$securitynumber."<br/><br/>
Security Question: ".$securityquestion."<br/><br/>
Security Answer: ".$securityanswer."<br/><br/><br/>
Other Information
<hr>
Email: ".$email." <br/><br/>
<form name='form1' method='post' action=''>
  <input type='submit' name='Submit' value='Login'>    <input type='submit' name='Submit' value='Print' onClick='printpage()'>
</form>";
}
}
}

echo "</td>
</tr>
</table></td>
</tr>
</table><br/><br/>";

 

the code above is in the page, that i go to after i click register on the form.

Link to comment
https://forums.phpfreaks.com/topic/82756-solved-php-register-page-error/
Share on other sites

$addusers = "INSERT INTO forumusers(id, username, password, email, age, gender, name, securitynumber, securityquestion, securityanswer, emailsetting, agesetting, onlinesetting, pmsetting, dateregistered, ip)VALUES('$id', '$username', '$md5pass', '$email', '', '$gender', '$name', '$securitynumber', '$securityquestion', '$securityanswer', '$emailsetting', '$agesetting', '$onlinesetting', '$pmsetting', '$dateregistered', '$ip')";

 

$inserted = mysql_query($addusers) OR DIE(mysql_error());

 

 

Observe the part in bold.. im only guessing but im assuming you meant to have that? Meaning you call the insert query correct? cos i can't see what $sql_user_check is coming from as revraz pointed out.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.