Jump to content

Pear::DB issues


xbase

Recommended Posts

here is the connection:

 

/*
Database Connection | Pear::DB API
--------------------------------------------------------------*/
$dsn = "mysql://$user:$pass@$host/$db_name";

$db = DB::connect($dsn);

if (DB::isError($db)) 
{
        die ($db->getMessage());
}

 

here is the code:

 

/**
* Creates the header for the directory
*
* @param string $hostname
* @param string $view
* @param string $i
* @return string
*/
function top_nav($hostname,$view, $i) 
{
		$l = chr($i);

		// Connect to the database so that 
		$s = "SELECT * FROM md_models WHERE alias REGEXP '^($l)'";
		$q = $db->query($s);

		if (DB::isError($result)) 
		{
        	die ($result->getMessage());
	}

	$r = $q->fetchRow();		
	$v = $db->getOne($s);


	// Print valid letters
	if ($v!=0)
	{
			$letter = '<td  width=20 align=center>
			<a href="index.CODE?cmd=find&l='.$l.'&view='.$view.'" 
			style="color: black; text-decoration: none; font-weight: bold">'.$l.'</a>
			</td>';
	 }
	 else
		{
			$letter = '<td  width=20 align=center style="color: #CCCCCC; font-weight: bold">'.$l.'</td>';
		}

return $letter;

}

 

This is the error:

Fatal error: Call to a member function on a non-object in /data1/members.scoreland/docs/cgi/secured/modeldir/lib/functions/functions.misc_utilities.CODE on line 77

 

Here is line 77:

		$q = $db->query($s);

 

Does anyone have any clue what is causing the issue, its starting to annoy me.

Link to comment
https://forums.phpfreaks.com/topic/38541-peardb-issues/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.