I do a transaction:
$dbh->beginTransaction();
$i = 0;
while ($i < $total_items_num) {
$insert_data->execute(
array( $item_data[ $i ],
$category,
$price,
)
);
$i++;
}
$dbh->commit();
On my local machine, items get inserted in proper order, e.g. from 1st to 7th. But on production server it gets inserted in reverse order, e.g. from 7th to 1st.
What could be the possible reason for this, some setting I need to change?
EDIT: Here is the query:
$insert_data = $dbh->prepare ("
INSERT INTO goods (
item_id,
item_data,
category,
price
)
VALUES (NULL, ?, ?, ?);
");
and the order of items was supposed to be from 0 to whatever number. E.g. 0-6, 0-15...
So what I'd want (and what works for me locally) is that item_id (which is primary key) gets applied to items in that very order, e.g. if 1st item had item_id 1025, then the second one should have 1026.
But what happens is they get inserted in reverse order.
Thanks for suggestions and sorry if question was vague, hopefully better now.