0

afternoon all! I am having some issue writing a log in script for a website! this is my first ever attempt so i am hoping it is something very straight forward!!!!

I am getting the following error message - Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /websites/123reg/LinuxPackage21/dr/ea/mt/dreamteamauction.com/public_html/checklogin.php on line 15
Wrong Username or Password

line 15 is the $count=mysql_num_rows($result); part. any suggestiong? will be much apprecaited! thanks

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<?php
$host="cust-mysql-123-06"; 
$username=""; 
$password="dummy"; 
$db_name="dummy"; 
$tbl_name="test"; 
mysql_connect("$host", "$username", "$password");
mysql_select_db("$db_name");
$username=mysql_real_escape_string($_POST['username']);
$password=mysql_real_escape_string($_POST['password']);
$sql="SELECT * FROM $tbl_name WHERE username='$username' and password='$password'";
$result=mysql_query($sql);
$count=mysql_num_rows($result);
if($count==1){
  session_register("username");
  session_register("password");
  header("location:login_success.php");
} else {
  echo "Wrong Username or Password";
}?>
2
Contributors
1
Reply
2
Views
4 Years
Discussion Span
Last Post by deceptikon
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.