Yii Framework Forum: query columns as Object - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

query columns as Object can't parse object to string Rate Topic: -----

#1 User is offline   briiC.lv 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 42
  • Joined: 25-April 09
  • Location:Latvia

Posted 06 May 2010 - 05:57 AM

i think its more php problem maybe, but if you know please help.
On my local machine all code is parsed without error, but on production server it's get error, which i can see in yii log

[error] [system.db.CDbCommand] Error in querying SQL: SELECT Object id #59 FROM ... etc.

and that rises error such
[error] [exception.CDbException] exception
'CDbException' with message 'CDbCommand failed to execute the SQL
statement: SQLSTATE[42S22]: Column not found: 1054 Unknown column
'Object' in 'field list'' in


you see SELECT here is columns list FROM ...
-_-
0

#2 User is offline   briiC.lv 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 42
  • Joined: 25-April 09
  • Location:Latvia

Posted 06 May 2010 - 06:11 AM

fixed.. if you can explain why it breaks here

$criteria = new CDbCriteria(); 
$criteria->select = new CDbExpression('FLOOR(RAND() * '.$rowCount.') as offset');


but if i dont use CDbExpression class, than its ok

$criteria->select = 'FLOOR(RAND() * '.$rowCount.') as offset';


it was not designed for these kind of functions to include in sql query?
-_-
0

#3 User is offline   Maurizio Domba Cerin 

  • Yii - Yesss It Is !!!
  • Yii
  • Group: Yii Dev Team
  • Posts: 4,358
  • Joined: 12-October 09
  • Location:Croatia

Posted 06 May 2010 - 06:26 AM

take a look at the documentation for CDbExpression

http://www.yiiframew...i/CDbExpression

it's mainly used for CActiveRecord attribute values...

EDIT: don't know why but this editor inserts <b></b> inside this link... so the link is not working!!!
Find more about me.... btw. Do you know your WAN IP?
0

#4 User is offline   Maurizio Domba Cerin 

  • Yii - Yesss It Is !!!
  • Yii
  • Group: Yii Dev Team
  • Posts: 4,358
  • Joined: 12-October 09
  • Location:Croatia

Posted 06 May 2010 - 06:28 AM

take a look at the documentation for CDbExpression

http://www.yiiframework.com/doc/api/CDbExpression


it's mainly used for CActiveRecord attribute values...
Find more about me.... btw. Do you know your WAN IP?
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users