How To Get Maximum Id From Mysql Table?

Hii all,

    i have one TextField inwhich i want to show maximum value from table tobe displayed in textFiled at the time of form load.

HI you can write simple sql query…

select MAX(id) from table_name

$criteria = new CDbCriteria();

$criteria->select = max(id),

$r = Model_Name_of_your_table::model()->find($criteria);

echo $r->id; 

try it