php/mysql error

Windwaker222

In Runtime
Messages
379
EDIT : oops..wrong programming forum..sorry

Here is the error I'm getting. It is for a login script :

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/www/ogwnet2.hollosite.com/login.php on line 30

Code:
if($submit){
               $conn = mysql_connect($host, $db_username, $db_password);
               $db = mysql_select_db($db_name) or
               print ("We are currently having troubles with the database.  Sorry for the inconvenience.  Please try again later.");
               
               
               
               $query = "SELECT * FROM login WHERE username LIKE '$username' AND password LIKE '$password'";   
               $result = mysql_query($query);
               $numrow = mysql_num_rows($result);
               
               if ($numrow==1) {
               print ("You have succesfully loged in as $username");
               }else{
               print ("There has been no account found under this name.  Please check for spelling and try again.");
               }
               }
               else{
               echo("Please Log-In to continue...<br>
               <form method=\"post\" action=\"login.php\">
               <input type=\"text\" name=\"username\" /><br>
               <input type=\"password\" name=\"password\" /><br>
               <input type=\"submit\" value=\"submit\" name=\"submit\" />
               </form>
               ");
            }
 
print ("There has been no account found under this name. Please check for spelling and try again.");
}
}
remove one of the }
 
Back
Top Bottom