...

View Full Version : I Keep getting a error in this Warning: mysql_fetch_array(): supplied argument is not



antigeek
03-06-2009, 02:09 AM
Hello everyone,

I keep getting this fool less error.
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /usr/home/yvtproc/public_html/Authentication/checkuser.php on line 18.


<?php
if (isset($_SERVER["PHP_AUTH_USER"])) {
$user = $_SERVER["PHP_AUTH_USER"];
$pass = $_SERVER["PHP_AUTH_PW"];
} elseif (isset($_SERVER["HTTP_AUTHORIZATION"])) {
if (substr($_SERVER["HTTP_AUTHORIZATION"], 0, 5) == "Basic") {
$userpass = split(":" ,
base64_decode(substr($_SERVER["HTTP_AUTHORIZATION"], 6)));
$user = $userpass[0];
$pass = $userpass[1];
}
}

$auth = false;
$pwdb = mysql_connect("localhost", "mysql_user", "mysql_password");
mysql_select_db("auth", $pwdb);
$rows = mysql_query("SELECT user, pass FROM users", $pwdb);
while ($row = mysql_fetch_array($result)) {

if ($user == $row["user"] && crypt($pass, "pw") == $row["pass"]) {
$auth = true;
break;
}
}

if (!$auth) {

}
?>

I been over and over on this script. what it suppose to be doing is checking the username and password that i added with another script. Could anyone help me out on this subject?

abduraooft
03-06-2009, 08:02 AM
Change
$rows = mysql_query("SELECT user, pass FROM users", $pwdb); to

$rows = mysql_query("SELECT user, pass FROM users", $pwdb) or die(mysql_error()); and check gain.

oesxyl
03-06-2009, 08:11 PM
also replace mysql_fetch_array with mysql_fetch_assoc if you use a hash array or use a second argument to force a hash assoc.

best regards



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum