Results 1 to 3 of 3

Thread: Fatal error: Call to a member function query() on a non-object

  1. #1
    Join Date
    May 2006
    Posts
    266
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Fatal error: Call to a member function query() on a non-object

    Hi i need to find out what this error is

    Fatal error: Call to a member function query() on a non-object in /home/*****/public_html/beta/system/articals/artical.php on line 15

    the code is
    Code:
    <?php
    require_once("configuration.php");
    $vconfig = new VConfig();
    
    $dbData = new DBData("localhost","$vconfig->user","$vconfig->dbpass","$vconfig->db");
    
    
    class DBData extends DBConnect{
            	
    		public function title(){
    			$result=$DBData->query('SELECT * FROM push_content');
    			$row=$result->fetch_assoc();
    			//echo user's password
    			print $row['title'];
    		   
    		}
    		
    			
        }
        
    
    ?>
    There is something wrong with this $result=$DBData->query('SELECT * FROM push_content');

    but from what i have worked out its something wrong with the $result=$DBData->query

    If any one can help that would be great.
    Thanks
    The web in one word.

  2. #2
    Join Date
    Jun 2009
    Posts
    62
    Thanks
    11
    Thanked 0 Times in 0 Posts

    Default

    shouldn't it be mysql_query(SELECT....);

  3. #3
    Join Date
    May 2006
    Posts
    266
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    Not when you are using OOP (object orientated Program)
    You can use the old php way or the new OOP/OOD
    The web in one word.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •