SOLVED: UDT that fails after upgrade to Hyacinthe

The place to talk about things that are related to CMS Made simple, but don't fit anywhere else.
Post Reply
Andrew Prior
Forum Members
Forum Members
Posts: 248
Joined: Sun Oct 28, 2007 4:14 am

SOLVED: UDT that fails after upgrade to Hyacinthe

Post 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
Andrew Prior
Forum Members
Forum Members
Posts: 248
Joined: Sun Oct 28, 2007 4:14 am

Re: SOLVED: UDT that fails after upgrade to Hyacinthe

Post by Andrew Prior »

// $db = cmsms()->db
SHOULD BE
// $db = cmsms()->GetDb()
Post Reply

Return to “The Lounge”