PHP Classes

class/user help

Recommend this page to a friend!

      PHP Secure Login and Registration  >  All threads  >  class/user help  >  (Un) Subscribe thread alerts  
Subject:class/user help
Summary:error i can not seem to figure out
Author:Josh Ownz
Date:2017-03-12 12:34:38

  1. class/user help   Reply   Report abuse  
Picture of Josh Ownz Josh Ownz - 2017-03-12 12:34:38
i been puzzled for a little over a day with this class/user.php error it says its on line 258 when i look up that area it shows this code $stmt = $pdo->prepare('SELECT id FROM users WHERE email = ? limit 1');
i got the correct db information typed in the database user i use has full privilege right when i created the database just trying to give in liniment of what was done and what i have tried i been trying to google the answer so i did not have to bug anyone but this has me stumped specially since i been teaching my self to code and read and figure out errors for coding websites thanks.

  2. Re: class/user help   Reply   Report abuse  
Picture of Daniel Fedorov Daniel Fedorov - 2017-05-14 23:41:21 - In reply to message 1 from Josh Ownz
RE: on line 258

I just installed this code on my local dev machine to test this. This script would give you an error on the line 255 according to the last revision from the author. This is 99.99% because you have entered an invalid database user info in a config.php file. Default values when you get this code are:

define('conString', 'mysql:host=localhost;dbname=login');
define('dbUser', 'root');
define('dbPass', 'root');

and here you need to make sure to put the name of the database you created - "login", or whatever you named it if you used another name. Then, double or triple check your dbUser name and dbPass if they match with what you type in the dbPass constant.

  3. Re: class/user help   Reply   Report abuse  
Picture of Dawny-Ray Reyes Dawny-Ray Reyes - 2017-08-12 22:12:16 - In reply to message 2 from Daniel Fedorov
I'm also having an issue with the same line, but the error I get is

"Fatal error: Call to a member function prepare() on null in ..\class\user.php on line 255"

  4. Re: class/user help   Reply   Report abuse  
Picture of David E. Nuttall David E. Nuttall - 2017-09-29 13:20:33 - In reply to message 3 from Dawny-Ray Reyes
Do you actually have at least one user record in the database?

That error MIGHT occur if the table exists but is empty or has an unvalidated registration.

I'm not 100% certain about the above, but looking at the line 255, that would be my first place to look.

San Antonio, TX

For more information send a message to info at phpclasses dot org.