Fatal error: Call to a member function setQuery() on a non-o

General questions relating to Joomla! There are other boards for more specific help on Joomla! features and extensions.

Moderator: General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Post Reply
Virangya
Joomla! Apprentice
Joomla! Apprentice
Posts: 11
Joined: Thu Mar 24, 2011 8:59 am

Fatal error: Call to a member function setQuery() on a non-o

Post by Virangya » Thu Apr 07, 2011 7:25 am

Hello,
I got this error:

Fatal error: Call to a member function setQuery() on a non-object in C:\wamp\www\newer\components\com_fabrik\fabrik_table.class.php on line 4647

I'm working on an old joomla project, i installed it to my local machine and working on it. My machine already has 1.5 joomla installation installed. I just copied the old site and just pasted on my WAMP server. to www folder. and its working fine except for this error. I understand that it's comming form the class of a module,(im not familiar with this site) and i found this code related to that error.

Code: Select all

$db = $this->getDb();
			$aPreFilters = $this->getPrefilterArray();
			$totalSql  	= "SELECT COUNT(" . $count . ") FROM " . $this->db_table_name . " " . $this->addJoinTableSQL( );
			$totalSql 	.= $this->getSQLWhere();
			$db->setQuery( $totalSql ); // this is the error line
			if (mosGetParam( $_REQUEST, 'fabrikdebug', '0' )) {
				echo $db->getQuery( );
Please help me resolve this...

Nandagopalan
Joomla! Intern
Joomla! Intern
Posts: 65
Joined: Thu Mar 17, 2011 5:52 am

Re: Fatal error: Call to a member function setQuery() on a n

Post by Nandagopalan » Thu Apr 07, 2011 10:08 am

Hi,

In your code the $db is not an correct object, because $this->getDb may not return the correct object.

So change the $db= $this->getDb(); to $db =& JFactory::getDBO();

let us know if this is helpful
Nandagopalan, Sr Developer
Trinay Technology Solutions
http://www.trinaytech.com
570-575-0475

Virangya
Joomla! Apprentice
Joomla! Apprentice
Posts: 11
Joined: Thu Mar 24, 2011 8:59 am

Re: Fatal error: Call to a member function setQuery() on a n

Post by Virangya » Fri Apr 08, 2011 9:22 am

Hey,

Thanx a lot for your reply! I found the error. It my database was missing some tables. But 8) thanx for you help! :pop

isa1975
Joomla! Apprentice
Joomla! Apprentice
Posts: 5
Joined: Sat Feb 11, 2012 10:46 am

Re: Fatal error: Call to a member function setQuery() on a n

Post by isa1975 » Tue May 29, 2012 5:52 pm

I have the same problem. Adsmanaeger displays
Fatal error: Call to a member function setQuery() on a non-object in
Part of the code is


function getEditFieldOptions($fid)
{
global $database,$option;
$database->setQuery("SELECT * FROM #__adsmanager_fieldcats WHERE fid = '$fid'");
$database->loadObject($row);

$return = "<div id='divfieldcatsOptions'>";
$return .= "<table class='adminform'>";
$return .= "<tr id='names' >";


I am desperately in need of help. This killing me.
Last edited by isa1975 on Sun Jun 03, 2012 8:42 pm, edited 1 time in total.

isa1975
Joomla! Apprentice
Joomla! Apprentice
Posts: 5
Joined: Sat Feb 11, 2012 10:46 am

Re: Fatal error: Call to a member function setQuery() on a n

Post by isa1975 » Tue May 29, 2012 5:54 pm

Nandagopalan wrote:Hi,

In your code the $db is not an correct object, because $this->getDb may not return the correct object.

So change the $db= $this->getDb(); to $db =& JFactory::getDBO();

let us know if this is helpful



I have the same problem. Adsmanaeger displays
Fatal error: Call to a member function setQuery() on a non-object in
Part of the code is


function getEditFieldOptions($fid)
{
global $database,$option;
$database->setQuery("SELECT * FROM #__adsmanager_fieldcats WHERE fid = '$fid'");
$database->loadObject($row);

$return = "<div id='divfielcatsdOptions'>";
$return .= "<table class='adminform'>";
$return .= "<tr id='names' >";


I am desperately in need of help. This killing me.


Post Reply

Return to “General Questions - 1.0.x”