Insert coding query in yii

Posted by nerd on Stack Overflow See other posts from Stack Overflow or by nerd
Published on 2012-12-08T06:22:48Z Indexed on 2012/12/08 11:07 UTC
Read the original article Hit count: 346

Filed under:
|
|
|

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

© Stack Overflow or respective owner

Related posts about php

Related posts about mysql