Hello
I’ve searched the forum but didnt find a solution so here my question.
I got yii on Uniform Server. Mysql db (name=mynewdb) .
I checked requirements and i got mysql pdo eanbled.
I want to use mysql instead of sqllite so i changed settings in:
protected/config/main.php
protected/config/console.php
commenting sqlite row and uncommenting and changing those of mysql
'db'=>array(
'connectionString' => 'mysql:host=localhost;dbname=mynewdb',
'emulatePrepare' => true,
'username' => 'root',
'password' => 'root',
'charset' => 'utf8',
),
when i try to use gii model generator i get a:
[color="#FF0000"]A valid database connection is required to run this generator[/color]. error
if i put in the same folder as my web application a php page to check db connection (the one below) i could connect to my db and retrieve data with no problem
try{
$dbh = new pdo( 'mysql:host=localhost;dbname=mynewdb',
'root',
'root',
array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION));
$statement = $dbh->prepare("select id from tbl_user where username = :name");
$statement->execute(array(':name' => "test"));
$row = $statement->fetch();
echo "requested id $row[0]";
die(json_encode(array('outcome' => true)));
}
catch(PDOException $ex){
die(json_encode(array('outcome' => false, 'message' => 'Unable to connect')));
}
What i’m doing wrong? thankyou alot in advance for any help