Joomla - Independent SQL query

2019-06-14 00:12发布

问题:

I'm wondering if someone can give me a bit of a hand.

I'm trying to write a query inside a PHP file in Joomla and its not really working that well, nothing is being output.

I'm very new to this Joomla stuff, so if someone could let me know where I'm going wrong that would be great.

My code is as follows:

$db =& JFactory::getDBO();
$query = "SELECT fullname FROM jos_jxzine_authors WHERE published = '1'";
$db->setQuery($query);
$column = $db->loadResultArray();

echo JHTML::_('select.options', $column, 'value', 'text', $this->categoryMap);

Cheers,

回答1:

Please use this query

$query = "SELECT fullname FROM `#__jxzine_authors` WHERE published = '1'";

joomla will itself add db prefix. So you must use #_ instead of jos



标签: php joomla