[SOLVED] ActiveRecord error - blank screen

Hello, I’m having trouble getting my model to use any find functions, however saving works fine.

This works:

$user = new User;

$user->username = 'username';

$user->password = 'password';


This causes a blank page:

$user = User::model()->findByPk(1000);

Also findBySql, find, and findAll cause the same error.

The error isn’t outputted in any server logs or in the browser, and error reporting is turned on.

If I put a return true in the queryInternal function inside CDbCommand.php, the error doesn’t happen (although neither does the find, of course)

If anyone has any ideas let me know! Also if you need to see any of my config or code…


to read any database entry I use CDbCriteria in this way:


$prd = new product();

$crit = new CDbCriteria();

$crit->condition = 'product = :id AND anleitung = :anl';

$crit->params = array(':pid'=>$id, ':anl'=>$typ);

$rows = $prd->findAll($crit);


My ‘product’ should be your ‘user’ …

Maybe it helps …

Thanks for the reply, I tried this:

$user = new User;

$users = $user->findAll();

and I still get a blank page.

Edit: Also tried this, still blank page


$command=$connection->createCommand('SELECT * FROM users LIMIT 1');


Your db connection probably is’nt setted up correctly

i mean, the user, password, host etc

I thought that might be the case at first but I’ve triple checked the credentials, and I am able to save records successfully.

Are there any configuration settings that would let me save but not let me select records?

Did you generated the model class to use AR ?

Some ideas to find the error:

echo $user->count(); // model ok ?

$users = $user->findAll();

print_r ($users); // details of returned array


Thanks for the suggestions. This was fixed by doing a yum update on my server. I believe my php-pdo was an older version.

Good tip