Announcement

Collapse
No announcement yet.

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

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

  • CeleronXT
    replied
    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*

    Leave a comment:


  • Cruz
    replied
    OOps..never mind, fixed it!
    Forgot to declare globals

    Leave a comment:


  • CeleronXT
    replied
    That creates the error.
    What error?

    Leave a comment:


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

    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?
widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
Working...
X