Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

mysql_insert_id

when i want to insert to database how can i find mysqlinsertid?

            $uof = new UserOrderForm();

            $uof->user_id = $user_id;
            $uof->aff_name = $order_name;
            $uof->order_date = $order_date;
            $uof->order_id = $order_no;
            $uof->amount = $order_amount;
            $uof->note = $order_note;
            $uof->status = 0;
            $uof->username = $order_email;

            $uof->save();

thanks



1.1k
Accepted
answer

if($uof->save()) { // $uof->id <=== inserted id }