Uhm .. I usually do: SELECT COUNT(id) FROM users WHERE name='$username' AND password='$password'
if (username is found) // hopefully it's unique found ya else sorry This way you aleays have a value returned... HTH Richard Thursday, April 8, 2004, 3:29:11 AM, you wrote: > hello, > I am trying to authenticate users. I run this MySQL query using > vars provided via a form.... > select password from dealers where username = '$user' > this works great if $user is actually a user in the database. > otherwise i get this error.... > Warning: mysql_result(): Unable to jump to row 0 on MySQL result index 3 > in /var/www/php/AuthTool.php on line 52 > its because of this.... > $thePass = mysql_result($result,'0','password'); > is there a way to stop this error, should i be using mysql_fetch_array > instead? Code below. > Thanks, > jd > function auth(){ > $user = $_POST['user']; > $pass = $_POST['pass']; > $query = "select password from dealers where username = '$user'"; > $result = $this->sqlQuery($query); > if(!$result){ > echo "Sorry there was a error\n"; > } > else{ > $thePass = mysql_result($result,'0','password'); > if($thePass){ > echo "$thePass\n"; > } > else{ > echo "no such user - $user\n"; > } > } > } > -- > [EMAIL PROTECTED] > "Bad spellers of the world untie!" -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php