Announcement

Collapse
No announcement yet.

Call to a member function on a non-object :X

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Call to a member function on a non-object :X

    Hey everyone,
    This error is coming from a NON-VB page, take into account!
    I have a mysql class that I am using, but it suddenly seems to have stopped working
    Here is the code that is causing trouble:
    PHP Code:
    if(!$user->checkuser()) { header('Location: ./login.php'); } 
    That creates the error. Here are the two classes it is referencing:
    PHP Code:
    <?php
     
    class clogin {
      
      var 
    $errmsg '';
      var 
    $users '';
      var 
    $md5enc 1// Use md5 Encryption
      
    var $db  null;
      
    /*edited out due to not being relevant*/  
      
    function checkuser() {
       
    //Check if session exist
       
       
    if(isset($_SESSION['uid']) && isset($_SESSION['upass'])) {
        
        
    $query 'SELECT * FROM '.DBT_USERS.' WHERE user_id = '.$_SESSION['uid']." AND user_passwd = '".$_SESSION['upass']."'";
        
    $results $this->db->query($query);
        
        if(!
    $this->db->num_rows($results)) return false;
        else return 
    true;
        
       } else {
        return 
    false;
       }
      }
      
    /*same here*/  
     
    }
    ?>
    and the extender:
    PHP Code:
     class user extends clogin  {
      
      function 
    getuser($userid) {
       
       
    $query 'SELECT * FROM '.DBT_USERS.' WHERE user_id = '.$userid;
       
    $results $this->db->query($query);
       
    $row $this->db->fetch_array($results);
       
       
    $user['id'] = $row['user_id'];
       
    $user['username'] = $row['user_username'];
       
    $user['email'] = $row['user_email'];
       
    $user['laston'] = $row['user_laston'];
       
       return 
    $user;
         
      }
      
     } 
    Anyone have any ideas?

  • #2
    That creates the error.
    What error?
    "63,000 bugs in the code, 63,000 bugs, you get 1 whacked with a service pack, now there's 63,005 bugs in the code."
    "Before you critisize someone, walk a mile in their shoes. That way, when you critisize them, you're a mile away and you have their shoes."
    Utopia Software - Current Software: Utopia News Pro (news management system)

    Comment


    • #3
      OOps..never mind, fixed it!
      Forgot to declare globals

      Comment


      • #4
        Originally posted by Cruz
        OOps..never mind, fixed it!
        Forgot to declare globals
        Oh good job.

        Let me guess, the error was "Call to a member function on a non-object"? *smacks self for not reading thread title*
        "63,000 bugs in the code, 63,000 bugs, you get 1 whacked with a service pack, now there's 63,005 bugs in the code."
        "Before you critisize someone, walk a mile in their shoes. That way, when you critisize them, you're a mile away and you have their shoes."
        Utopia Software - Current Software: Utopia News Pro (news management system)

        Comment

        widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
        Working...
        X