phpdevshell team mailing list archive
-
phpdevshell team
-
Mailing list archive
-
Message #01079
Re: [Question #209172]: How can I interact with a remote database in my own plugins?
Question #209172 on PHPDevShell changed:
https://answers.launchpad.net/phpdevshell/+question/209172
Status: Open => Answered
Greg proposed the following answer:
You got the principle right :) however you don't have to override any
method, as long you wan to connect to a Mysql server.
class test_connector extends PHPDS_legacyConnector
{
protected $dbHost = "localhost";
protected $dbName = "test";
protected $dbUsername = "username";
protected $dbPassword = "userpassword";
}
class test_query extends PHPDS_query
{
protected $connector = "test_connector";
protected $sql = "SHOW TABLES";
}
$tables = $this->db->invokeQuery('test_query');
print '<pre>';
print_r($tables);
print '</pre>';
You just have to provide the query with the connector class name, and it
will handle the black magic for you
--
You received this question notification because you are a member of
PHPDevShell, which is an answer contact for PHPDevShell.