Welcome Guest, Not a member yet? Register   Sign In
insert, get ID of insert [FIXED: My fault]

(This post was last modified: 04-13-2020, 09:30 AM by Kaosweaver.)

PHP Code:
$order_id $orderModel->insert($data); 

Then tried:

PHP Code:
$order_id $orderModel->insertID(); 

Neither returned the inserted ID

I don't understand why the first one wasn't built to return this information automatically - but whatever, why didn't the second one work?

I did check the database, the record is inserted. I should get the ID of the inserted record, right?

First, make sure you're including all of the columns in the model declaration (left off order_id) and, also, don't make the wrong ID the key (also didn't have the right key for the table for the model). So, once those were fixed, it all worked fine.

Messages In This Thread
insert, get ID of insert [FIXED: My fault] - by Kaosweaver - 04-13-2020, 08:26 AM

Theme © iAndrew 2016 - Forum software by © MyBB