It seems there is something wrong with my script for the reason that
it always returns, UserName NOT found . I know it connects to the db
fine because I don't get a error. So just been trying to figure out
what's wrong. I am using PEAR btw.
Pastebin: http://pastebin.ca/360410
<?PHP
require 'DB.php';
$db = DB::connect('my sql://lol:lol@localho st/user');
if (DB::isError($d b)) {die('ERROR{1}: ' . $db-
$user = $_POST['user'];
$password = md5($_POST['password']);
$password2 = md5($_POST['password2']);
$sql = check();
function check()
{
global $db;
global $user;
$rows = $db->getAll('SELE CT user_name FROM user');
if (DB::isError($d b)) {die('ERROR{2}: ' . $db->getMessage()); }
if($user){
if(array_key_ex ists("$user", $rows)){print "<p><b>User Name
AcceptED</b>";}else{prin t "<p><b>User Name NOT found</b>";}
}else{print "<p>no username was typed";}
}
?>
it always returns, UserName NOT found . I know it connects to the db
fine because I don't get a error. So just been trying to figure out
what's wrong. I am using PEAR btw.
Pastebin: http://pastebin.ca/360410
<?PHP
require 'DB.php';
$db = DB::connect('my sql://lol:lol@localho st/user');
if (DB::isError($d b)) {die('ERROR{1}: ' . $db-
>getMessage() ); }else{print "We connected";}
$password = md5($_POST['password']);
$password2 = md5($_POST['password2']);
$sql = check();
function check()
{
global $db;
global $user;
$rows = $db->getAll('SELE CT user_name FROM user');
if (DB::isError($d b)) {die('ERROR{2}: ' . $db->getMessage()); }
if($user){
if(array_key_ex ists("$user", $rows)){print "<p><b>User Name
AcceptED</b>";}else{prin t "<p><b>User Name NOT found</b>";}
}else{print "<p>no username was typed";}
}
?>
Comment