Page 1 of 1

SOLVED: UDT that fails after upgrade to Hyacinthe

Posted: Wed May 09, 2012 7:59 am
by Andrew Prior
Duketown and Jos helped me (http://forum.cmsmadesimple.org/viewtopi ... 28&t=55565)

with the UDT code below. After upgrading from Fanui to Hyacinthe, I get the following error:
Fatal error: Call to a member function Execute() on a non-object in /home/blahblah/public_html/lib/classes/class.usertagoperations.inc.php(260) : eval()'d code on line 7
I know the UDT referred to by the error message is the one below as I have three UDTs based on it, and when I bracket them out everything else works.

Code: Select all

// Make a connection to the database

$db = cmsms()->db; 
//SHOULD BE $db = cmsms()->GetDb();
// $query = 'SELECT * FROM '.cms_db_prefix().'pics WHERE num=7';
$query = "SELECT * FROM ".cms_db_prefix()."pics ORDER BY RAND() LIMIT 0,1";

$dbresult = $db->Execute($query );

// Now show the images information
while ($dbresult && $row = $dbresult->FetchRow())
{
 $num = $row['num'];
  $alt = $row['alt'];
  $title = $row['title'];
 
echo '<img src="uploads/images/sidebars/side_'.$num.'.jpg" alt="'.$alt.'" title="'.$title.'" />'; 
echo "\n"; 
}
I have tracked down that this line is where the error occurs

Code: Select all

$dbresult = $db->Execute($query );
I am assuming that the way the database is to be referenced has been changed slightly in the upgrade, but am way outside my competency.



If anyone could check this I would be most grateful.

Andrew Prior

Re: SOLVED: UDT that fails after upgrade to Hyacinthe

Posted: Wed May 09, 2012 10:37 am
by Andrew Prior
// $db = cmsms()->db
SHOULD BE
// $db = cmsms()->GetDb()