- I've tested that $GLOBALS['mysql'] is a PDO resource and the Information is accurate.
- I tested if I was getting any errors, and PDO wasn't receiving any from MYSQL.
- I'm not getting any exceptions.
- The foreach loop isn't returning anything. So I suppose that the table doesn't exist, but it does. I see it and the database has the table.
Code: Select all
if(!empty($_POST['username']) and preg_match('/^[a-zA-Z]{1}[ _a-zA-Z0-9-]{5,99}$/', $_POST['username']) and preg_match('/^[a-z-A-Z0-9]{5,100}$/', $_POST['password']))
{
try {
$statement = $GLOBALS['mysql']->prepare("SELECT COUNT(*) FROM gh_users WHERE username=:username AND pass=PASSWORD(:password)");
$statement->bindParam(':username', $username);
$statement->bindParam(':password', $password);
$username = $_POST['username'];
$password = $_POST['password'];
$statement->execute();
$row = $statement->fetch(PDO::FETCH_NUM);
$exists = (bool) $row[0];
foreach($GLOBALS['mysql']->query("SELECT * FROM gh_users") as $row)
{
print_r($row);
}
}
catch(PDOException $e) { var_dump($e); }
}