yii - Getting last inserted id from a table not part of the current controller I am in -


i need last inserted id table not part of current model nor current database connection: right in table (pdtlisting) want last inserted id table (deallisting). how can it?

try this..

its mysql..

last_insert_id() 

or

its php..

mysql_insert_id()  last_insert_id functions (be php wrappers or native mysql one) typically refer last id created using current database connection. last login not created during same request showing table in, method won't work you.  use normal select find out newest login instead - e.g. using order creationtime desc limit 1. 

or in yii can find last inserted id ..

yii::app()->db->getlastinsertid(); 

also can refer link..

http://www.yiiframework.com/doc/api/1.0/cactiverecord#primarykey-detail


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -