putha-nee's Profile
Reputation: 0
Apprentice
- Group:
- Active Members
- Active Posts:
- 168 (0.13 per day)
- Joined:
- 04-October 09
- Profile Views:
- 1,000
- Last Active:
Dec 19 2011 05:25 PM- Currently:
- Offline
Previous Fields
- Dream Kudos:
- 0
Latest Visitors
-
Eitxor 
12 Dec 2011 - 14:36
Posts I've Made
-
In Topic: PHP and Database Authentication
Posted 8 Dec 2011
Okay, but based on running rowCount(), when the rowCount is 1, it runs through the first if statement. If it is 0, then it runs into the else statement.
What I am trying to understand is how is it telling itself that if $users (which contains a login and password returned by the table if the user exists), then run through the if statement.
If after running the userid and password by the user do not return a match after the query, (i.e. rowCount = 0), then go into the else statement. -
In Topic: PHP and Database Authentication
Posted 8 Dec 2011
One quick question I got just for the purpose of understand.
After fetching the $users, it returns Array.
So why is it that when I have
if($users) { //only is executed if the returned result is in the array } else { // only executes when result is not in the array (i.e. incorrect login credentials) }
As far as i understood, the select statement checks if the userid and password are in the table. Then the next line creates the PDO object. Then you fetch the rows. From there, how does if($users) only work with valid credentials and the else {} automatically do the invalid credentials. -
In Topic: PHP and Database Authentication
Posted 8 Dec 2011
FINALLY!!
Yeah, I quoted the strings literally RIGHT BEFORE you posted mate and that resolved thing issue!
Thanks a ton guys
The var_dump and rowCount() are two methods I will never forget!!!
Hours of stupid troubleshooting now worth while! -
In Topic: PHP and Database Authentication
Posted 8 Dec 2011
Okay, so I just ran the vardump code you mentioned, and it returned bool(false) which I assume implies or confirms that the query is returning false.
So I changed the query to just SELECT * FROM table1; and the vardump return an object. So the error has to do with checking the username and password which I am getting from the login page with the following:
if(isset($_GET['submitCredentialsBtn'])) { //get the data from the Login.php form $userIDs=$_GET['user']; $passwordIDs=$_GET['password']; }
and the original query which returned false wasSELECT * FROM gautad WHERE student_id=$userIDs AND password=$passwordIDs
Do you perhaps see an issue which I am missing -
In Topic: PHP and Database Authentication
Posted 8 Dec 2011
After doing what you just suggested, I got another error:
Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[42S22]: Column not found: 1054 Unknown column '$userIDs' in 'where clause'' in C:\xampp\htdocs\assign3\AuthLogin.php:34 Stack trace: #0 [file]: PDO->query('SELECT * FROM g...') #1 {main} thrown in [file] on line 34
My Information
- Member Title:
- D.I.C Head
- Age:
- Age Unknown
- Birthday:
- Birthday Unknown
- Gender:
Contact Information
- E-mail:
- Private
Friends
|
|


Find Topics
Find Posts
View Reputation Given
|
Comments
putha-nee has no profile comments yet. Why not say hello?