Hi all,
I seem to be having a problem. I get the above error when trying my login script.
<?php
$dbhost = "localhost";
$dbname = "userlogin";
$dbuser = "adminuser";
$dbpass = "xxxxxxx";
$dbtable = "users";
mysql_connect ( $dbhost, $dbuser, $dbpass, $dbtable)or die("Could not connect: ".mysql_error());
mysql_select_db($dbname) or die(mysql_error());
session_start();
$username = $_POST[‘username’];
$password = md5($_POST[‘password’]);
$query = "SELECT * FROM users WHERE username=’$username’ AND password=’$password’";
$result = mysql_query($query);
if (mysql_num_rows($result) != 1) {
echo 'Bad Login';
include "index.php";
} else {
$_SESSION[‘username’] = '$username';
include “memberspage.php”;
}
?>
It comes up on line 21.
The full error is:
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in C:\WebServerDocs\Public\login.php on line 21
Bad Login
I am using Apache 2.0 , MySQL 5.0, php 5 on windows platform.
Any help would be much appreciated.
Thanks