Cannot change database using JDatabase::getInstance - Joomla! Forum - community, help and support
hello,
i moving components 1.5 2.5 , i'm facing problems mysql.
the main problem cannot understand how data database in same server.
as suggested in http://docs.joomla.org/connecting_to_an ... l_database tried:
the error
it seems jdatabase::getinstance ignored joomla, seems original connection database still used, because joomla looking table mytable inside original_database, instead of looking mytable inside new_database.
any help?
i people rtfm, problem here lack of documentation...
thanks in advance
i moving components 1.5 2.5 , i'm facing problems mysql.
the main problem cannot understand how data database in same server.
as suggested in http://docs.joomla.org/connecting_to_an ... l_database tried:
code: select all
<?php
$option = array(); //prevent problems
$option['driver'] = 'mysqli'; // database driver name
$option['host'] = '127.0.0.1'; // database host name
$option['user'] = ''myuser'; // user database authentication
$option['password'] = 'xxx'; // password database authentication
$option['database'] = 'new_database'; // database name
$option['prefix'] = ''; // database prefix (may empty)
$db = & jdatabase::getinstance( $option );
$query = $db->getquery(true);
$query->select('id, name');
$query->from('mytable');
return $query;
?>the error
table 'original_database.mytable' doesn't exist sql=select id, name mytable
it seems jdatabase::getinstance ignored joomla, seems original connection database still used, because joomla looking table mytable inside original_database, instead of looking mytable inside new_database.
any help?
i people rtfm, problem here lack of documentation...
thanks in advance
it seems $option array ignored, if change $option['host'] dummy server, still connection server database....
Comments
Post a Comment