
July 24th, 2003, 07:54 AM
|
|
Contributing User
|
|
Join Date: Nov 2002
Posts: 61
Time spent in forums: < 1 sec
Reputation Power: 6
|
|
|
Supplied argument is not valid MySQL result resource?
Hi there everyone,
Long time ive been away! now im back on the php trail doing a little revision.
Anyway, I have created the following username / password login script:
PHP Code:
<?
extract($_Post);
$link = mysql_connect("localhost", "uname", "pass");
mysql_select_db("auth", $link);
$name = mysql_query("SELECT name FROM logstudent WHERE name = '$logon' AND pass = '$password'", $link);
$num_rows = mysql_num_rows($name);
if ($num_rows <= 0)
{
echo "<p align=center>You either entered your user name or password wrong. </p>";
exit;
}
echo "<p align=left>You are now logged in</p>";
include ("showdetails.php");
?>
I keep getting the following warning: -
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in C:\www\checkstudent.php on line 8
(line 8 is : $num_rows = mysql_num_rows($name);
I know that I am supplying the correct username and password, so it has to be something with the actual database/table?
Can anyone explain what this error means so I can track down the problem further.
Also, the database is called "auth", and there are 2 columns called: - "logon" for usernames ans "password" for passwords"
As always, thanX in advance.
__________________
SAFC
Last edited by Gee : July 24th, 2003 at 08:11 AM.
|