Hello,
I Am having problems with a simple script i wrote to login a username and password from a mysql database.
i get the error
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in H:\steadyology\steadyology\account.php on line **21
I ran the script on my localhost where i have php and mysql running. the following is the query i perfomrmed on the datbase table user
<?php
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
// always modified
header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache"); // HTTP/1.0
include("config.php");
$user=$_POST["user"]; $user=strtoupper($user);
$pass=$_POST["pass"];
$query="select password from user where user=$user";
$result=mysql_query("select * from user where user=$user",$db);
if(!($arr=mysql_fetch_array($result))){//rest that username exists
include("loginerror.htm");
exit;
}
$done=strcmp($arr["password"],$pass);
if(!($done==0)){ // test that password is correct
include("loginerror.htm");
exit;
The line number with error is ****if(!($arr=mysql_fetch_array($result)))
the user table has the following fields
user_id (primary key)
user (contains the username)
pass (the password)
Any help will be appreciated.
Thank you
**