setQuery() can not be run in ChronoConnectivity?

maxxoros 05 Aug, 2009
I give a simple code for example
The header
<table width="100%">
<?php $db = JFactory::getDBO(); ?>

And now is body
<?php
		$query = "SELECT * FROM #__content;";
		$db->setQuery($query);		
	    $rows = $db->loadObjectList();	
?>

 <tr>
    <td width="42%" height="21">{name}</td>
<?php		
		foreach($rows as $ro) {		
			echo $ro->title;
		}
?>
    <td width="25%">{admin_menu_link}</td>
    <td width="33%">{option}</td>
  </tr>


But I get this issue

Fatal error: Call to a member function setQuery() on a non-object in D:\xampp\htdocs\joomla\components\com_chronoconnectivity\libraries\connection.php(293) : eval()'d code on line 3



That mean setQuery() to run a SQL command can not be run, this is, because of Connectivity? Are there anyway to pass by this

Thanks for any help 🙂
GreyHead 05 Aug, 2009
Hi maxxoros,

I found this week that you can't run a DB query inside the 'body' section of ChronoConnectivity. I think that this is because it's actually being generated inside a DB query. If you print out the query you'll find that it's blank and is never executed.

I found a way to run my queries outside the body loop. You could try setting up a second DB connection $db2 =& new JFactory::DBO(); might work; alternatively it might be possible to modify the CC code so that the loop is executed after the db query is complete - I haven't looked at the code to see what is happening.

Bob
maxxoros 06 Aug, 2009
Now I get this issue with new DB :?

Parse error: parse error, expecting `T_VARIABLE' or `'$'' in D:\xampp\htdocs\joomla\components\com_chronoconnectivity\libraries\connection.php(236) : eval()'d code on line 2

This topic is locked and no more replies can be posted.