vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Query data from a different database? (https://vborg.vbsupport.ru/showthread.php?t=206283)

lisagreenfern 02-23-2009 12:38 AM

Query data from a different database?
 
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 *****):

Code:

$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.

Code:

$upcomingevents = mysql_fetch_array( $result );

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

$row = mysql_fetch_array[ $result );

$upcomingevents = $row['title'];

Thanks!


All times are GMT. The time now is 05:58 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01335 seconds
  • Memory Usage 1,712KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (3)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (3)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete