I am having a problem with understanding how to authenticate based on database entries.
I have a login page, and a database page which is able to access my database properly. However, I have entries in the database with username and passwords which I am trying to authenticate for, but can't get my hand around how. Here is the authentication php so far. I am getting the username and password entered, but again, don't understand how to put together the if statement in which if the username and password entered by the user are the username and password int he database table, then do something.
<?php
//runs the PDO access code from database.php
require 'database.php';
//checks to see if login form was submitted and if so, executes if statement
if(isset($_GET['submitCredentialsBtn']))
{
//get the data from the Login.php form
$userID=$_GET['user'];
$passwordID=$_GET['password'];
}
//queries gautad table to retreive all records
$query = "Select * FROM table1 where student_id=$userID AND password=$passwordID";
// $users creates the result set
$users = $db->query($query);
if ( //this is where i'm lost)
{
}
?>

New Topic/Question
Reply




MultiQuote




|