0
When trying to connect phpactiverecord to the database in XAMPP phpmyadmin through 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') );
The following error message is received:
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 solved? Thanks in advance.
User:
<?php
require_once 'settings/config.php';
class UsuarioModel extends ActiveRecord\Model {
static $table_name = 'tdusuario';
}
Thank you very much!!!
– Beatriz
@Beatriz has solved herself please mark the answer as correct ;)
– Guilherme Nascimento