Hey everybody, I'm new to PHP, and am having a seemingly simple problem, (Probably a stupid error on my part, atleast I really hope so) I hope you can help me deal with this, and to say thanks for any efforts, I will build 1,000's of backlinks for you, for one website, along with 1 keyword/anchor.

onto the problem

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in *omitted for my privacy* on line 25

Warning: mysql_fetch_object(): supplied argument is not a valid MySQL result resource in *omitted for my privacy* on line 26

<?php
session_start();
include_once("includes/db_connect.php");
if (strip_tags($_GET['logout']) == "yes"){
session_destroy();
}elseif (isset($_SESSION['real_name'])){
header("Location: Updates.php");
exit();
}


if ($_POST['Submit'] && strip_tags($_POST['username']) && strip_tags($_POST['password'])){
$username = $_POST['username']; 
$password = $_POST['password'];
$username = strip_tags($username);
$password = strip_tags($password);
$ip = $REMOTE_ADDR;


$date = gmdate('Y-m-d h:i:s');


///check INFO
$sql = mysql_query("SELECT * FROM users WHERE username='$username' AND password='$password' LIMIT 1"); 
$login_check = mysql_num_rows($sql); 
$inf = mysql_fetch_object($sql); 

if ($login_check > "0"){
if ($inf->status == "Dead"){
include_once"dead.php";
exit();

$timenow=time();
$online = time() - 300; //the current time minus 300 seconds
$select = mysql_query("SELECT * FROM users WHERE onlinetime2 >='$online' AND online='Online' ORDER by id ASC");
$num = mysql_num_rows($select);
$numfor=number_format($num);

}
        session_register('username'); 
        $_SESSION['real_name'] = $inf->username; 
		$_SESSION["userlevel"] = $inf->userlevel;
		$_SESSION["crewlevel"] = $inf->crewlevel;


$realip = isset($_SERVER['HTTP_X_FORWARDED_FOR']) ?
$_SERVER['HTTP_X_FORWARDED_FOR'] : $_SERVER['REMOTE_ADDR'];       

   $time2 = time();    
       
         $timestamp = time()+60; 
		 
mysql_query("UPDATE users SET online='Online', onlinetime2='$time2' WHERE username='$username'");
        
mysql_query("INSERT INTO `logs` ( `id` , `who` , `action` , `date` , `ip` ) VALUES ('', '$username', 'Logged In!', '$date', '$realip')");

        header("Location: News.php"); 
   
} else { 
    $message= "You could not be logged in.<br />";

}}
?>
 
<html>
  <head>
  <meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
<link REL="SHORTCUT ICON" type="image/ico" HREF="icon here">
  <meta name="author" content="Bigharry">
  <title>Mafia-Assassins</title>
  <link href="site_css.css" rel="stylesheet" type="text/css">
<script src="clienthint.js"></script> 
  </head>

<body bgcolor="black" OnLoad="document.login.mail.focus();">
<div align="center">

  <strong><font color='red' face='verdana' size='1'> <br>
  <br>
  </font></strong>
  <table width="965" border="0" cellspacing="0" cellpadding="0">
    <tr> 
      <td valign="bottom"> 
      <table width="965" border="0" cellspacing="0" cellpadding="0">
  <tr>

    <td width="349" valign="bottom">
<table width="349" border="0" cellspacing="0" cellpadding="0">
        <tr> 
          <td width="23"><div align="center"><img src="banner.jpg" width="966" height="168"></div></td>
          
        </tr>
      </table>
    </td>
    
    
  </tr>
</table></td>
    </tr>

    <tr>
      <td> 
        <table width="965" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td width="200" valign="top" class="home-side"> 
             <br>
<br>  
<div class="brown"><center>Major Updates</center></div> 
<div align="left" class="mafia-game">
<li>Refferal System has been fixed and updated.<br><br>

<li>The game layout has been slightly updated.<br><br>
<li>A blackjack casino is being made.<br><br>
</div>




<div align="left" class="mafia-game">
</div></td>
            <td valign="top"> 
              <table border="0" cellspacing="0" cellpadding="0" width="565" height="302" class="home-pic1">
                <tr>

                  <td height="270" valign="top"> 
                    <table width="100%" border="0" cellpadding="0" cellspacing="0">
                      <tr>
                        <td height="168" valign="top"> <br>
                          <p class="home-text"><br>
                            <br>
                            <a href="Register2.php"><strong></strong></a> 
                             <font size="-2"></font></p>
                          <strong><font color='red' face='verdana' size='1'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font></strong></td>

  </tr>
  <tr>
                        <td valign="bottom"> 
						
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td>

 <form id="form1" name="form1" method="post" action="index.php">



<div style="padding: 10px 0 0 400px;">

                       <input name="username" type="text" class="input-home" id="username" size="15" maxlength="35">

<br>
<br>
                       <input name="password" type="password" id="password2" class="input-home" size="15" maxlength="35">
<br>
                       <input type="submit" name="Submit" value="Login">
</div>

		 </form>		 </td>

  </tr>
</table></td>
  </tr>

</table>
<br>
<br>
<br>
<br>
<br>
<center>
<body style="margin: 0px" bgcolor="black" vlink="black" alink="black">

</body></center>
</td></tr></table>          


            <td width="200" valign="top" class="home-side">

            
<div class="mafia-game">
<br>

<div class="brown">Need help playing?</div><br>
			  We have added a guide to help new users to the game or users that are new to the mafia life.<br>
			 
			  <strong><br>
			  </strong><br>
    </div></td>
          </tr><div align="center" class="style"><a href="lost_pass.php">Lost Password </a><label> :: </label><a href="Register2.php"> Register </a><label> :: </label><a href="tos.php"> Terms of Service </a>

<br>
<br>
<br>
<font color="lime"><b>Mafia-Assassins is Open.</b></font></div></center>
        </table>



       


      
        </td>
    </tr>
    <tr>
      <td>


</script></body>
</html>

Sorry for the double post, But apparently I can only edit my OP before x amount of minutes have passed.

I searched google, multiple other forums, including daniweb's search function, best I could, but it seems I'm the only person with this exact problem (I did find one very similar to this, but there was no answer to it), or maybe I misunderstood, if this has already been solved, I apologize in advance. & ask you to point me in the right direction, thanks.

Did you read the sticky thread a the top of this forum ? Anyway, there are tons of threads here, al with the same problem...

I did read it, perhaps not well enough, thanks.

I'm sorry, but I just don't get it, I just don't see what I did wrong, or what I can do to fix it, I've read it twice now, and idk what else to say.

EDIT: I read it for the third, and final, time, and I seriously don't get it, the codes they use as examples look nothing like the ones I'm being referred to.

$sql = mysql_query("SELECT * FROM users WHERE username='$username' AND password='$password' LIMIT 1"); 
if (!sql) {
  // query failed
  die(mysql_error());
}
else {
  $login_check = mysql_num_rows($sql); 
  if ($login_check > 0) {
    // record found
    $inf = mysql_fetch_object($sql); 
  }
  else {
    // no record found
  }
}

Thank you so much, It worked, do you have a website I can build you backlinks for? I use scrapebox, and can build you a few thousand backlinks over night, just tell me in a PM, I'll need an anchor/keyword you would like me to use, and whether yu would prefer wordpress or blogengine comments.

EDIT: I think it worked atleast, now i only have one error on line 30, so I guess i'm halfway there.

Thanks, but not necessary. Mark your thread as solved is quite enough.

I will, as soon as i fix line 30 :P

I hate to bother you... again, but that only seems to of only fixed one problem,

now this top line is the problem

Here's the error: Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /fake path on line 30

$login_check = mysql_num_rows($sql); 
  if ($login_check > 0) {
    // record found
    $inf = mysql_fetch_object($sql); 
  }
  else {
    // no record found
  }
}
if ($login_check > "0"){
if ($inf->status == "Dead"){
include_once"dead.php";
exit();

I could of swore I did it right, and it seemed to fix one of the problems, which is what baffles me.


I can't believe I managed to screw that up, can please tell me what I did wrong? I seem to be having one of those weeks... You know, the ones where all you can do is screw everything up.

Can you show more code, what comes before line 1. There has to be something wrong with your query.

<?php
session_start();
include_once("includes/db_connect.php");
if (strip_tags($_GET['logout']) == "yes"){
session_destroy();
}elseif (isset($_SESSION['real_name'])){
header("Location: Updates.php");
exit();
}


if ($_POST['Submit'] && strip_tags($_POST['username']) && strip_tags($_POST['password'])){
$username = $_POST['username']; 
$password = $_POST['password'];
$username = strip_tags($username);
$password = strip_tags($password);
$ip = $REMOTE_ADDR;


$date = gmdate('Y-m-d h:i:s');


///check INFO
$sql = mysql_query("SELECT * FROM users WHERE username='$username' AND password='$password' LIMIT 1"); 
if (!sql) {
  // query failed
  die(mysql_error());
}
else {
  $login_check = mysql_num_rows($sql); 
  if ($login_check > 0) {
    // record found
    $inf = mysql_fetch_object($sql); 
  }
  else {
    // no record found
  }
}
if ($login_check > "0"){
if ($inf->status == "Dead"){
include_once"dead.php";
exit();

thanks for the reply.

I hope you meant $sql in the line below

if (!sql) {

I didn't actually, I changed it, but the problem still persists, thanks for pointing that out.

what is your current code? Try to add or die(mysql_error()) in each mysql function so that you can spot where the problem is

i'll post my whole code, and add that to each of them, thanks.

EDIT: Where exactly should i add "or die(mysql_error())" to? Is there a certain line/code I should add it after?

2nd edit: I tried adding it to a few places, and it seemed to of only made the problem worse.

the error is still Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /fakepath on line 30

I'm not very familiar with PHP, so sorry if it's a stupid question.

<?php
session_start();
include_once("includes/db_connect.php");
if (strip_tags($_GET['logout']) == "yes"){
session_destroy();
}elseif (isset($_SESSION['real_name'])){
header("Location: Updates.php");
exit();
}


if ($_POST['Submit'] && strip_tags($_POST['username']) && strip_tags($_POST['password'])){
$username = $_POST['username']; 
$password = $_POST['password'];
$username = strip_tags($username);
$password = strip_tags($password);
$ip = $REMOTE_ADDR;


$date = gmdate('Y-m-d h:i:s');


///check INFO
$sql = mysql_query("SELECT * FROM users WHERE username='$username' AND password='$password' LIMIT 1"); 
if ($sql) {
  // query failed
  die(mysql_error());
}
else {
  $login_check = mysql_num_rows($sql); 
  if ($login_check > 0) {
    // record found
    $inf = mysql_fetch_object($sql); 
  }
  else {
    // no record found
  }
}
if ($login_check > "0"){
if ($inf->status == "Dead"){
include_once"dead.php";
exit();

$timenow=time();
$online = time() - 300; //the current time minus 300 seconds
$select = mysql_query("SELECT * FROM users WHERE onlinetime2 >='$online' AND online='Online' ORDER by id ASC");
$num = mysql_num_rows($select);
$numfor=number_format($num);

}
        session_register('username'); 
        $_SESSION['real_name'] = $inf->username; 
		$_SESSION["userlevel"] = $inf->userlevel;
		$_SESSION["crewlevel"] = $inf->crewlevel;


$realip = isset($_SERVER['HTTP_X_FORWARDED_FOR']) ?
$_SERVER['HTTP_X_FORWARDED_FOR'] : $_SERVER['REMOTE_ADDR'];       

   $time2 = time();    
       
         $timestamp = time()+60; 
		 
mysql_query("UPDATE users SET online='Online', onlinetime2='$time2' WHERE username='$username'");
        
mysql_query("INSERT INTO `logs` ( `id` , `who` , `action` , `date` , `ip` ) VALUES ('', '$username', 'Logged In!', '$date', '$realip')");

        header("Location: News.php"); 
   
} else { 
    $message= "You could not be logged in.<br />";

}}
?>
 
<html>
  <head>
  <meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
<link REL="SHORTCUT ICON" type="image/ico" HREF="icon here">
  <meta name="author" content="Bigharry">
  <title>Mafia-Assassins</title>
  <link href="site_css.css" rel="stylesheet" type="text/css">
<script src="clienthint.js"></script> 
  </head>

<body bgcolor="black" OnLoad="document.login.mail.focus();">
<div align="center">

  <strong><font color='red' face='verdana' size='1'> <br>
  <br>
  </font></strong>
  <table width="965" border="0" cellspacing="0" cellpadding="0">
    <tr> 
      <td valign="bottom"> 
      <table width="965" border="0" cellspacing="0" cellpadding="0">
  <tr>

    <td width="349" valign="bottom">
<table width="349" border="0" cellspacing="0" cellpadding="0">
        <tr> 
          <td width="23"><div align="center"><img src="banner.jpg" width="966" height="168"></div></td>
          
        </tr>
      </table>
    </td>
    
    
  </tr>
</table></td>
    </tr>

    <tr>
      <td> 
        <table width="965" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td width="200" valign="top" class="home-side"> 
             <br>
<br>  
<div class="brown"><center>Major Updates</center></div> 
<div align="left" class="mafia-game">
<li>Refferal System has been fixed and updated.<br><br>

<li>The game layout has been slightly updated.<br><br>
<li>A blackjack casino is being made.<br><br>
</div>




<div align="left" class="mafia-game">
</div></td>
            <td valign="top"> 
              <table border="0" cellspacing="0" cellpadding="0" width="565" height="302" class="home-pic1">
                <tr>

                  <td height="270" valign="top"> 
                    <table width="100%" border="0" cellpadding="0" cellspacing="0">
                      <tr>
                        <td height="168" valign="top"> <br>
                          <p class="home-text"><br>
                            <br>
                            <a href="Register2.php"><strong></strong></a> 
                             <font size="-2"></font></p>
                          <strong><font color='red' face='verdana' size='1'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font></strong></td>

  </tr>
  <tr>
                        <td valign="bottom"> 
						
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td>

 <form id="form1" name="form1" method="post" action="index.php">



<div style="padding: 10px 0 0 400px;">

                       <input name="username" type="text" class="input-home" id="username" size="15" maxlength="35">

<br>
<br>
                       <input name="password" type="password" id="password2" class="input-home" size="15" maxlength="35">
<br>
                       <input type="submit" name="Submit" value="Login">
</div>

		 </form>		 </td>

  </tr>
</table></td>
  </tr>

</table>
<br>
<br>
<br>
<br>
<br>
<center>
<body style="margin: 0px" bgcolor="black" vlink="black" alink="black">

</body></center>
</td></tr></table>          


            <td width="200" valign="top" class="home-side">

            
<div class="mafia-game">
<br>

<div class="brown">Need help playing?</div><br>
			  We have added a guide to help new users to the game or users that are new to the mafia life.<br>
			 
			  <strong><br>
			  </strong><br>
    </div></td>
          </tr><div align="center" class="style"><a href="lost_pass.php">Lost Password </a><label> :: </label><a href="Register2.php"> Register </a><label> :: </label><a href="tos.php"> Terms of Service </a>

<br>
<br>
<br>
<font color="lime"><b>Mafia-Assassins is Open.</b></font></div></center>
        </table>



       


      
        </td>
    </tr>
    <tr>
      <td>


</script></body>
</html>

the problem is line 30

wait a minute,
isn't line 25 supposed to be as below?

if (!$sql) {
  // query failed
  die(mysql_error());
}
commented: Missed my own typo. +6

That did it, ty very much, now all I need to do is set up my SQL database, and hope more things don't screw up.

I will make this thread as solved, once i'm sure no more problems will arise.

As always something else has managed to screw up, it's another Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /fakepath/Register2.php on line 48

but the really strange thing is, line 48 is blank, im pretty sure it's referring to the line above it, since it's the code it quoted in the error, but I may aswell post it for reference.

After I added the "die mysql error" line this error occurs

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /fakepath/Register2.php on line 47 Unknown column 'email' in 'where clause'

EDIT: I have updated the below code to reflect my changes, I can't help but feel like I've made it worse.

<html>
  <head>
  <title>Mafia-Assassins :: Register</title>
  <meta name="author" CONTENT="okay">
  
<script language="JavaScript">
<!--

function SymError()
{
  return true;
}

window.onerror = SymError;

//-->
</script>
  
    	<link REL="stylesheet" TYPE="text/css" HREF="main.css">
    
  </head>

<body bgcolor="#000000" onLoad="grabit()">

<?PHP

include "includes/db_connect.php";
$datetime = gmdate('Y-m-d h:i:s');


if ($_POST['Submit'] && strip_tags($_POST['username']) && strip_tags($_POST['password']) && strip_tags($_POST['cpassword']) && strip_tags($_POST['email'])){

$ip=$_SERVER["REMOTE_ADDR"]; //draws IP address of visitor



$email = $_POST['email']; 
$email = strip_tags($email);
$username = $_POST['username']; 
$username = strip_tags($username);
$password = $_POST['password']; 
$password = strip_tags($password);
$cpassword = $_POST['cpassword']; 
$cpassword = strip_tags($cpassword);

$checkname = mysql_query("SELECT * FROM users WHERE username='$username' OR email='$email'");
$NameCount = mysql_num_rows($checkname);
  die(mysql_error());
}
if ($NameCount > 0)
{
	echo "<font color=red>The username and/or email address is already in use<BR>Please <a href=\"Register2.php\">go back</a> and try again</font>";
}
else{

if (!(isset($email))){
echo 'You must insert an email address and/or username!';
}else{

mysql_query("INSERT INTO `users` ( `id` , `username` , `password` , `email` ,`ip` ) VALUES ('', '$username', '$password', '$email', '$ip')");
mysql_query("INSERT INTO `crimetimes` ( `id` , `username` , `crime1` , `crime1a` , `crime2` ,`crime2a` , `crime3` , `crime3a` , `crime4` ,`crime4a` , `crime5` , `crime5a` ) VALUES ('', '$username', '', '0', '', '0', '', '0', '', '0', '', '0')");
mysql_query("INSERT INTO `signups` ( `id` , `username` , `date` ) VALUES ('', '$username', '$datetime')");

    
// mail user their information

$yoursite = "www.mafia-assassins.net/";
$webmaster = "Bigharry";
$youremail = "Mafia-Assassins Registration Center";
    
$subject = "Registration Details";
$message = "Dear $username, you are now registered at mafia-assassins.net.  
    To login, simply go to $yoursite and enter in the following details in the login form:
    Username: $username
    Password: $password
    
    Please print this information out and store it for future reference.
    
    Thanks,
    $webmaster";
    
mail($email, $subject, $message, "From: $yoursite <$youremail>\nX-Mailer:PHP/" . phpversion());
    
echo "<font color=red><b>You have successfully Registered!</b></font>
";
}}
?>        <html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta name="keywords" content="mafia, role-play, role, play, game, rpg, game">
<meta name="description" content="A multi-player game where people compete to rise through the ranks of the mafia. Commit crimes, gamble at the casino and much more!">
<title>Mafia-Assassins</title>
<link href="includes/inc-style.css" type="text/css" rel="stylesheet" />
</head>
<body style="margin:0px; background-image: url(images/mainbg.png); background-repeat: no-repeat; background-position: top">
<br>
<br>
<br>
<br>
<table cellspacing="0" cellpadding="0" border="0" align="center" class="main" width="585">
  <tr>

    <td align="center"><img src="banner.jpg"></td>
  </tr>
  <tr>
    <td align="center">
	      <div style="font-weight: bold; font-size: 10pt; width: 184px">Register</div>
		  <div style="font: 10px Verdana; color: #FF9900; text-align: center">
		  		  </div>
		  		  <br />
          <form action="/Register2.php" method="post">
            <table cellspacing="0" cellpadding="2" border="0" align="center" class="main">
              <tr class="subhdr">
                <td colspan="2" align="left">* - Required fields<br></td>
              </tr>
              <tr>
                <td align="right" class="subhdr">Username: *</td>
                <td style="width: 120px"><input type="text" name="username" maxlength="100"></td>

              </tr>
              <tr>
                <td align="right" class="subhdr">Password: *</td>
                <td><input type="password" name="password" maxlength="100"></td>
              </tr>
              <tr>
                <td align="right" class="subhdr">Password confirm: *</td>
                <td><input type="password" name="cpassword"></td>

              </tr>
              <tr>
                <td align="right" class="subhdr">Email: *</td>
                <td><input type="text" name="email"></td>
              </tr>
              <tr>
                <td align="right" colspan="2"><input name="Submit" type="Submit" value="Submit"></td>
              </tr>
            </table>
          </form>
		          </div>


<center><p><a href='index.php'><b>Index</b></a></p></center>

You should apply the same construct everywhere, with the extra checks.

I edited my post, I think I did the right thing, but I probably didn't in all honesty.

OFF-TOPIC: Nice new avatar, I <3 bender.

I think you forgot to copy some of it. It is very hard to read now.

-- Thanks, just finished re-watching the entire series.

Ok i'll repost everything.

the current problem is:

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /fakepath/Register2.php on line 47
Unknown column 'email' in 'where clause'

here's my page.

<html>
  <head>
  <title>Mafia-Assassins :: Register</title>
  <meta name="author" CONTENT="okay">
  
<script language="JavaScript">
<!--

function SymError()
{
  return true;
}

window.onerror = SymError;

//-->
</script>
  
    	<link REL="stylesheet" TYPE="text/css" HREF="main.css">
    
  </head>

<body bgcolor="#000000" onLoad="grabit()">

<?PHP

include "includes/db_connect.php";
$datetime = gmdate('Y-m-d h:i:s');


if ($_POST['Submit'] && strip_tags($_POST['username']) && strip_tags($_POST['password']) && strip_tags($_POST['cpassword']) && strip_tags($_POST['email'])){

$ip=$_SERVER["REMOTE_ADDR"]; //draws IP address of visitor



$email = $_POST['email']; 
$email = strip_tags($email);
$username = $_POST['username']; 
$username = strip_tags($username);
$password = $_POST['password']; 
$password = strip_tags($password);
$cpassword = $_POST['cpassword']; 
$cpassword = strip_tags($cpassword);

$checkname = mysql_query("SELECT * FROM users WHERE username='$username' OR email='$email'");
$NameCount = mysql_num_rows($checkname);
  die(mysql_error());
}
if ($NameCount > 0)
{
	echo "<font color=red>The username and/or email address is already in use<BR>Please <a href=\"Register2.php\">go back</a> and try again</font>";
}
else{

if (!(isset($email))){
echo 'You must insert an email address and/or username!';
}else{

mysql_query("INSERT INTO `users` ( `id` , `username` , `password` , `email` ,`ip` ) VALUES ('', '$username', '$password', '$email', '$ip')");
mysql_query("INSERT INTO `crimetimes` ( `id` , `username` , `crime1` , `crime1a` , `crime2` ,`crime2a` , `crime3` , `crime3a` , `crime4` ,`crime4a` , `crime5` , `crime5a` ) VALUES ('', '$username', '', '0', '', '0', '', '0', '', '0', '', '0')");
mysql_query("INSERT INTO `signups` ( `id` , `username` , `date` ) VALUES ('', '$username', '$datetime')");

    
// mail user their information

$yoursite = "www.mafia-assassins.net/";
$webmaster = "Bigharry";
$youremail = "Mafia-Assassins Registration Center";
    
$subject = "Registration Details";
$message = "Dear $username, you are now registered at mafia-assassins.net.  
    To login, simply go to $yoursite and enter in the following details in the login form:
    Username: $username
    Password: $password
    
    Please print this information out and store it for future reference.
    
    Thanks,
    $webmaster";
    
mail($email, $subject, $message, "From: $yoursite <$youremail>\nX-Mailer:PHP/" . phpversion());
    
echo "<font color=red><b>You have successfully Registered!</b></font>
";
}}
?>        <html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta name="keywords" content="mafia, role-play, role, play, game, rpg, game">
<meta name="description" content="A multi-player game where people compete to rise through the ranks of the mafia. Commit crimes, gamble at the casino and much more!">
<title>Mafia-Assassins</title>
<link href="includes/inc-style.css" type="text/css" rel="stylesheet" />
</head>
<body style="margin:0px; background-image: url(images/mainbg.png); background-repeat: no-repeat; background-position: top">
<br>
<br>
<br>
<br>
<table cellspacing="0" cellpadding="0" border="0" align="center" class="main" width="585">
  <tr>

    <td align="center"><img src="banner.jpg"></td>
  </tr>
  <tr>
    <td align="center">
	      <div style="font-weight: bold; font-size: 10pt; width: 184px">Register</div>
		  <div style="font: 10px Verdana; color: #FF9900; text-align: center">
		  		  </div>
		  		  <br />
          <form action="/Register2.php" method="post">
            <table cellspacing="0" cellpadding="2" border="0" align="center" class="main">
              <tr class="subhdr">
                <td colspan="2" align="left">* - Required fields<br></td>
              </tr>
              <tr>
                <td align="right" class="subhdr">Username: *</td>
                <td style="width: 120px"><input type="text" name="username" maxlength="100"></td>

              </tr>
              <tr>
                <td align="right" class="subhdr">Password: *</td>
                <td><input type="password" name="password" maxlength="100"></td>
              </tr>
              <tr>
                <td align="right" class="subhdr">Password confirm: *</td>
                <td><input type="password" name="cpassword"></td>

              </tr>
              <tr>
                <td align="right" class="subhdr">Email: *</td>
                <td><input type="text" name="email"></td>
              </tr>
              <tr>
                <td align="right" colspan="2"><input name="Submit" type="Submit" value="Submit"></td>
              </tr>
            </table>
          </form>
		          </div>


<center><p><a href='index.php'><b>Index</b></a></p></center>

-- I've probably seen every episode of futurama more than a few times, used to watch it all the time when it was on adult swim, before comedy central bought the rights to it from them. With the exception of the new ones on comedy central, have only caught a few of those.

$checkname = mysql_query("SELECT * FROM users WHERE username='$username' OR email='$email'");

fails because there is no column `email` in the `users` table.

I think that code should look like this:

$checkname = mysql_query("SELECT * FROM users WHERE username='$username' OR email='$email'") or die(mysql_error());
if ($checkname)
  $NameCount = mysql_num_rows($checkname);
else
  $NameCount = 0;

if ($NameCount > 0)
  // etc...

Thank you, yet again, I'm starting to understand more of this, atleast I think so.

Now there's one problem I'm very confused about, the error is:

Unknown column 'email' in 'where clause'

no page, or line is specified, which I find extremely odd, this may not even be a PHP related error for all I know.

i'll post my code

EDIT: I created a new table in mysql database, and it seemed to do away with the error, however, it still won't work, and it gives me no errors, I hate to think that all of this was a waste of time, but unfortunately it seems that way...

off-topic- I'm sending you a PM.

<html>
  <head>
  <title>Mafia-Assassins :: Register</title>
  <meta name="author" CONTENT="okay">
  
<script language="JavaScript">
<!--

function SymError()
{
  return true;
}

window.onerror = SymError;

//-->
</script>
  
    	<link REL="stylesheet" TYPE="text/css" HREF="main.css">
    
  </head>

<body bgcolor="#000000" onLoad="grabit()">

<?PHP

include "includes/db_connect.php";
$datetime = gmdate('Y-m-d h:i:s');


if ($_POST['Submit'] && strip_tags($_POST['username']) && strip_tags($_POST['password']) && strip_tags($_POST['cpassword']) && strip_tags($_POST['email'])){

$ip=$_SERVER["REMOTE_ADDR"]; //draws IP address of visitor



$email = $_POST['email']; 
$email = strip_tags($email);
$username = $_POST['username']; 
$username = strip_tags($username);
$password = $_POST['password']; 
$password = strip_tags($password);
$cpassword = $_POST['cpassword']; 
$cpassword = strip_tags($cpassword);

$checkname = mysql_query("SELECT * FROM users WHERE username='$username' OR email='$email'") or die(mysql_error());
if ($checkname)
  $NameCount = mysql_num_rows($checkname);
else
  $NameCount = 0;

if ($NameCount > 0)
	echo "<font color=red>The username and/or email address is already in use<BR>Please <a href=\"Register2.php\">go back</a> and try again</font>";
}
else{

if (!(isset($email))){
echo 'You must insert an email address and/or username!';
}else{

mysql_query("INSERT INTO `users` ( `id` , `username` , `password` , `email` ,`ip` ) VALUES ('', '$username', '$password', '$email', '$ip')");
mysql_query("INSERT INTO `crimetimes` ( `id` , `username` , `crime1` , `crime1a` , `crime2` ,`crime2a` , `crime3` , `crime3a` , `crime4` ,`crime4a` , `crime5` , `crime5a` ) VALUES ('', '$username', '', '0', '', '0', '', '0', '', '0', '', '0')");
mysql_query("INSERT INTO `signups` ( `id` , `username` , `date` ) VALUES ('', '$username', '$datetime')");

    
// mail user their information

$yoursite = "www.mafia-assassins.net/";
$webmaster = "Bigharry";
$youremail = "Mafia-Assassins Registration Center";
    
$subject = "Registration Details";
$message = "Dear $username, you are now registered at mafia-assassins.net.  
    To login, simply go to $yoursite and enter in the following details in the login form:
    Username: $username
    Password: $password
    
    Please print this information out and store it for future reference.
    
    Thanks,
    $webmaster";
    
mail($email, $subject, $message, "From: $yoursite <$youremail>\nX-Mailer:PHP/" . phpversion());
    
echo "<font color=red><b>You have successfully Registered!</b></font>
";
}}
?>        <html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta name="keywords" content="mafia, role-play, role, play, game, rpg, game">
<meta name="description" content="A multi-player game where people compete to rise through the ranks of the mafia. Commit crimes, gamble at the casino and much more!">
<title>Mafia-Assassins</title>
<link href="includes/inc-style.css" type="text/css" rel="stylesheet" />
</head>
<body style="margin:0px; background-image: url(images/mainbg.png); background-repeat: no-repeat; background-position: top">
<br>
<br>
<br>
<br>
<table cellspacing="0" cellpadding="0" border="0" align="center" class="main" width="585">
  <tr>

    <td align="center"><img src="banner.jpg"></td>
  </tr>
  <tr>
    <td align="center">
	      <div style="font-weight: bold; font-size: 10pt; width: 184px">Register</div>
		  <div style="font: 10px Verdana; color: #FF9900; text-align: center">
		  		  </div>
		  		  <br />
          <form action="/Register2.php" method="post">
            <table cellspacing="0" cellpadding="2" border="0" align="center" class="main">
              <tr class="subhdr">
                <td colspan="2" align="left">* - Required fields<br></td>
              </tr>
              <tr>
                <td align="right" class="subhdr">Username: *</td>
                <td style="width: 120px"><input type="text" name="username" maxlength="100"></td>

              </tr>
              <tr>
                <td align="right" class="subhdr">Password: *</td>
                <td><input type="password" name="password" maxlength="100"></td>
              </tr>
              <tr>
                <td align="right" class="subhdr">Password confirm: *</td>
                <td><input type="password" name="cpassword"></td>

              </tr>
              <tr>
                <td align="right" class="subhdr">Email: *</td>
                <td><input type="text" name="email"></td>
              </tr>
              <tr>
                <td align="right" colspan="2"><input name="Submit" type="Submit" value="Submit"></td>
              </tr>
            </table>
          </form>
		          </div>


<center><p><a href='index.php'><b>Index</b></a></p></center>

"Unknown column 'email' in 'where clause'" comes from your mysql query on line 46. I think you may have misspelled email, or something went wrong when creating your table and the column may be missing. Check your table in mysql/phpmyadmin.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.