Forums

Retriving Data Joomla Tables

zoom 11 Dec, 2007
Can I use the Joomla method of retrieving data to populate some dropdown lists I'm using in my forms using database tables located within my Joomla installation?

It seems that using the following statement fails because it can't find the class.

$database =& JFactory::getDBO();
php error: Fatal error: Class 'JFactory' not found


What do I need to include within my chronoform to use the Joomla database methods to access tables to build my form??

Thanks..
GreyHead 11 Dec, 2007
Hi zoom,

$database is already defined, try just using the methods.

Bob
zoom 11 Dec, 2007
GreyHead,

I tried using the methods, however I'm getting an error about using the methods. Do I need to include something?

$database->setQuery($sql);
$getrows = $database->loadObjectList();

Fatal error: Call to a member function setQuery() on a non-object<br><br>Post edited by: zoom, at: 2007/12/11 17:18
zoom 11 Dec, 2007
Greyhead,
I figured it out. I just needed to include the global var $database and it worked fine. Thanks
GreyHead 11 Dec, 2007
Hi zoom,

I thought that might do it and was just checking when I saw your post. (Not sure why you need to redeclare as I think you are still in the same function, but if it works that's fine.)

Bob
ricardo_arango 20 Dec, 2007
I think I am having the same problem. How did you include that variable?


global $database;


This is not working for me...
Max_admin 25 Dec, 2007
Hi Ricardo,

I think this has been solved at the other thread ?

Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
This topic is locked and no more replies can be posted.