Forum Moderators: open
PAGE A: a PHP file that updates a database with inital user info (ip address, date, etc). Prints out a form, which submits to Page B.
PAGE B: another PHP file that's supposed to write more info to the same reccord as Page A.
Using PHP or AJAX, how can I capture which record id Page A writes to, so that Page B can write to the same reccord.
Insert into db (fields) value (values);
select id from db order by id desc limit 1;
Use result to set $id.
<input type="hidden" name="id" value="$id">
Page B would use this field to update the record, make sure you error trap in case something goes wrong and the value is blank.
This is a "shortcut" way of getting last ID, not all that efficient, but it works, see recent discussion [webmasterworld.com]. I think mysql has a last_record function (or similar,) I've just stuck with this method. Yeah, lazy . . . .