PDA

View Full Version : Query data from a different database?


lisagreenfern
02-23-2009, 12:38 AM
I am trying to display a list of events from Joomla, which is on a different database and server. I am new to writing VB plugins, but here is what I have so far (real information replaced with *****):


$this->dbobject->connect('**databasename***','***hostname***','3306 ','***user***','***password***',false);

$result = $db->query_read("SELECT title FROM jos_events");
or die(mysql_error());

$row = mysql_fetch_array( $result );

echo "Event Title: ".$row['title'];

It doesn't display anything when i include it in template with $upcomingevents (the name of the plugin), and I'm REALLY hoping someone can look at this and give me a clue what's wrong. I've been working on this for hours! I think what I'm trying is possible because of this post: https://vborg.vbsupport.ru/showthread.php?p=1314797 I just don't have the experience to know what's wrong.

Any help would be appreciated. :)

BSMedia
02-23-2009, 12:43 AM
You need to make $upcomingevents a value and not just the name of the plugin

lisagreenfern
02-23-2009, 12:51 AM
Is this what you mean? It didn't work, so I'm probably writing something wrong.


$upcomingevents = mysql_fetch_array( $result );


I also tried this: (it also didn't work)

$row = mysql_fetch_array[ $result );

$upcomingevents = $row['title'];

Thanks!