I am pretty new to Joomla, and I'm stuck!
I'm trying to access the Joomla DB from a PHP script, using the JFactory::getDBO(); method. I noticed all my queries were returning '0' results, even though the SQL looks fine.
I then noticed that
$db = JFactory::getDBO();
echo "Database prefix is : " . $db->getPrefix();
Outputs:
"Database prefix is : jos_".
My DB Prefix should be - "wvfd_".
This is the part of code that initializes joomla:
define( '_JEXEC', 1 );
define( 'DS', DIRECTORY_SEPARATOR );
define( 'JPATH_BASE', realpath(dirname(__FILE__).DS.'..' ));
require_once ( JPATH_BASE .DS.'includes'.DS.'defines.php' );
require_once ( JPATH_BASE .DS.'includes'.DS.'framework.php' );
$mainframe =&JFactory::getApplication('site');
I have checked in the Joomla backend, and the prefix is set correctly. I have checked configuration.php, and it is set correctly in there too?
Why is $db = JFactory::getDBO(); connecting me to a DB that does not exist?
All/Any help appreciated, thanks!
JPATH_BASE
is defined correctly and pointing to the correct directory as you have have a different prefix on different installations