jd2007 Posted July 22, 2007 Share Posted July 22, 2007 +----+-----------------+--------+-----------+-----------------+-------+ | id | name | worked | notworked | link | romno | +----+-----------------+--------+-----------+-----------------+-------+ | 1 | A Sim | 0 | 0 | asim.exe | 1 | | 2 | Truck Sim | 1 | 0 | trucksim.exe | 2 | | 4 | Top Gun | 1 | 0 | topgun.exe | 3 | | 8 | BBBBBBBBBBBBBBB | 0 | 0 | BBBBBBBBBBBBBBB | 0 | | 7 | USA Tank Sim | 0 | 0 | tanksim.exe | 5 | +----+-----------------+--------+-----------+-----------------+-------+ the highest value in id is 8, how do i select this number ? Quote Link to comment Share on other sites More sharing options...
redarrow Posted July 22, 2007 Share Posted July 22, 2007 that wont work as the id is incremented each time data is inputed but if insest use max(id) Quote Link to comment Share on other sites More sharing options...
Barand Posted July 22, 2007 Share Posted July 22, 2007 If you are inserting a new record and need the latest id to insert related record/s in another table then the safest way is to call $newid = mysql_insert_id(); immediately after the insert and use that value to insert in other table. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.