Insert coding query in yii
- by nerd
I need to auto insert the next orders_id into an Orders table in a database. orders_id is not the primary Key, and it does not auto-increment
I need to query the database, find the last (highest) id value, increment 1, and insert it in Orders table in database. Actually, I have a shipping action which will provide address of shipping of orders. So as soon as the user fills address form and move to payments page, I want to simultaneously fill my Orders table by max(orders_id)+1.
I have built relations between Address table and Orders table but my orders Table is not getting populated. Please detail me correct codes to implement it in my controller in Yii