MySQL and NOW()

Hi guys,

I’m a total newbie to Yii, and I managed to find my first roadblocker :)

I'd like to run the following query:

As you can see in the subject the problem is with the 'NOW()' part.

I can't get Yii to include that part into the query.

So far I tried:

When I check the logs I can see the query, but without 'valid_to > NOW()' part.

Can somebody help me out with this one?

Thanks!

Your first line of code should work.

Thanks for the quick reply!

Yeah it works.

I have another newbie question. I'd like to modify a crud's admin page to display data from joined tables.

What I did:

  • added relation to model:
'settings'=>array(self::HAS_MANY, 'Kw_settings', 'keywords_id'),
  • changed queries in controller:
$pages=new CPagination(Keywords::model()->with('settings')->together()->count($criteria));


$keywordsList=Keywords::model()->with('settings')->together()->findAll($criteria);
  • added the following to the admin view inside the foreach loop:
<?php echo $model->settings->szorzo; ?>

'szorzo' is the name of the column from the other table (Kw_settings).

The problem is, it won't display a thing.

What am I doing wrong?

$model->settings is an array since you declare it to be HAS_MANY.