Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6718873
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T09:01:34+00:00 2026-05-26T09:01:34+00:00

I keep getting an error Call to a member function execute() on a non-object

  • 0

I keep getting an error Call to a member function execute() on a non-object in /home... on line 44

Line 44 is the last $statement. $db is injected, don’t know why it doesn’t work. the query above works fine.

public $userinfo = array();
public $time_now = 0;
public $session_time = 3600;
public $db;
public $config;

public function __construct($db,$config)
{
    $this->userinfo['ip'] = $_SERVER['REMOTE_ADDR'];
    $this->time_now = time();
    $this->db = $db;
    $this->config = $config;
    $this->userinfo['userid'] = 0;
    $this->userinfo['level'] = 0;
}
function validate_user()
{
    if ($temp_userid = $_SESSION['userid'] > 0)
    {
        $sql = "SELECT userid,level,name,email,lastactivity  
                FROM user 
                WHERE userid = ? LIMIT 1";

        $statement = $this->db->prepare($sql);
        $statement->execute(array($temp_userid));
        $sid_row = $statement->fetchObject();

        if ($sid_row)
        {
            $this->userinfo['userid'] = $sid_row->userid;
            $this->userinfo['level'] = $sid_row->level;
            $this->userinfo['name'] = $sid_row->name;
            $this->userinfo['email'] = $sid_row->email;

            if ($this->time_now-600 > $sid_row->lastactivity)
            {
                $sql = "UPDATE user SET lastactivity = ? WHERE userid = ? LIMIT 1";
                $statement = $this->db->prepare($sql);
                $statement->execute(array($this->time_now,$this->userinfo['userid']));
            }
        }
    }....................
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T09:01:34+00:00Added an answer on May 26, 2026 at 9:01 am

    Why don’t you try $statement = $this->db->execute ?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I keep getting this error whenever I call gethostbyname() in my C code. ==7983==
I keep getting this error when I try to call Find() public void findTxt(string
I am trying to call ejabberdctl from PHP but i keep getting an error
when I call my awk script, I keep getting an error : sam@sam-laptop:~/shell/td4$ awk
I keep getting this error when I call 'tomcat:run'. The plugin 'org.apache.maven.plugins:maven-tomcat-plugin' does not
I keep getting the error Stream was not writable whenever I try to execute
While developing with Firebug I keep getting this error. pages[x].css(z-index,x) is not a function
With the following code, I keep getting error C2535 when I compile. It's complaining
Keep getting this error after inserting a subdatasheet into a query and trying to
I keep getting this error System.Web.HttpException was unhandled by user code Message=Validation of viewstate

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.