Unqiue ID columns - PHP or MySQL query?
Posted: Mon Feb 26, 2007 5:27 pm
Hi,
I have several tables - e.g. Products, Manufacturers, that has a unique ID associated with each row - e.g. ProductID, ManufacturerID.
When I delete rows in the middle of the table, I want to reassign the IDs into numerical order.
Also, when I insert a row at the end, I want to know the last ID in the table without having to read the whole table.
How do I carry out both operations, and should this be carried out via a MySQL query, or via PHP?
Many thanks
I have several tables - e.g. Products, Manufacturers, that has a unique ID associated with each row - e.g. ProductID, ManufacturerID.
When I delete rows in the middle of the table, I want to reassign the IDs into numerical order.
Also, when I insert a row at the end, I want to know the last ID in the table without having to read the whole table.
How do I carry out both operations, and should this be carried out via a MySQL query, or via PHP?
Many thanks