Jump to content

Search the Community

Showing results for tags 'spl'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 1 result

  1. I have : session_start(); spl_autoload_register(null, false); spl_autoload_extensions(".class.php"); function classLoader($class){ $filename = strtolower($class) .'.class.php'; $file = 'core/classes/' .$filename; if(!file_exists($file)){ return false; } require $file; } function connectLoader($connect){ $filename = strtolower($connect) .'.class.php'; $file = 'core/connect/' .$filename; if(!file_exists($file)){ return false; } require $file; } spl_autoload_register('connectLoader'); spl_autoload_register('classLoader'); In an init.php that is called at the top of each page. I keep receiving errors with regards to non member objects when trying to access the site. Fatal error: Call to a member function prepare() on a non-object in /home/a6696695/public_html/core/classes/users.class.php on line 185 on that line is a function that retrieves user data from the database: //function to return the user data public function userData($id){ $query = $this->db->prepare("SELECT * FROM users WHERE id =?"); $query->bindValue(1, $id); try{ $query->execute(); //returns all user data in the form of an array - access in other pages, index etc. return $query->fetch(); }catch(PDOException $e){ die($e->getMessage); } }//end userData function This function is called in the init after the spl calls. //instantiating the classes $users = new Users($db); $admin = new Admin($db); $general = new General(); $helper = new Helper(); //check if user is logged in, get id from session and data if($general->loggedIn() === true){ $userId = $_SESSION['id']; $user = $users->userData($userId); } Help please
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.