When trying to connect phpactiverecord to the database in phpmyadmin XAMPP by means of this code:
<?php
require_once 'php-activerecord/ActiveRecord.php';
$cfg = ActiveRecord\Config::instance ();
$cfg->set_model_directory ( 'model' );
$cfg->set_connections ( array ('development' => 'mysql://root@localhost/phpmyadmin/dbaqua') );
You receive the following error message:
Fatal error:
Uncaught exception 'ActiveRecord\DatabaseException'
with message
"exception 'PDOException'
with message 'SQLSTATE[HY000] [1049] Unknown database 'phpmyadmin/dbaqua'"
in C:\xampp\htdocs\BancoAQUA\service\library\php-activerecord\lib\Connection.php:202
>Stack trace:
>0 C:\xampp\htdocs\BancoAQUA\service\library\php-activerecord\lib\Connection.php(202): PDO->__construct('mysql:host=loca...', 'root', NULL, Array)
>1 C:\xampp\htdocs\BancoAQUA\service\library\php-activerecord\lib\Connection.php(99): ActiveRecord\Connection->__construct(Object(stdClass))
>2 C:\xampp\htdocs\BancoAQUA\service\library\php-activerecord\lib\ConnectionManager.php(33): ActiveRecord\Connection::instance('development')
>3 C:\xampp\htdocs\BancoAQUA\service\library\php-activerecord\lib\Table.php(83): ActiveRecord\ConnectionManager::get_connection(NULL)
>4 C:\xampp\htdocs\BancoAQUA\service\library\php-activerecord\lib\Table.php(61): ActiveRecord\Table->__construct('UsuarioModel')
>5 C:\xampp\htdocs\BancoAQUA\service\library\php-activerecord\lib\M in C:\xampp\htdocs\BancoAQUA\service\library\php-activerecord\lib\Connection.php on line 204
How can this be fixed? Thank you in advance.
UserModel:
<?php
require_once 'settings/config.php';
class UsuarioModel extends ActiveRecord\Model {
static $table_name = 'tdusuario';
}