Your database is borked. Whatever you did lost the auto-increment attribute on several, perhaps all, tables. That could have been because of a wrong setting when making a backup that you later imported, or something about the way you imported the data.
I'm strongly inclined to say you need to re-do your database import.
This is why I always do my upgrades by staging them on a test database, and then when everything's tested and solid I do the actual upgrade against the real live database, so that I never have to risk an export/import mucking up my actual original data. All explained at http://www.zen-cart.com/entry.php?3-...d-of-upgrading
Anyway, I'll re-write the ultra-long version of what I was saying previously:
a) Auto-Incrementing is used to tell the database to auto-assign "the next available integer value" to the particular field in the database when doing inserts of new records. This causes every record to have a unique identifier, and also aids in indexing for performance. You can see that most of these tables have the auto-increment attribute on the xyz_id field (note the _id suffix which is often used). It's also supposed to set the primary-key of (most of) those tables to be that same _id field, to enforce uniqueness.
b) because of your tables not having the necessary auto_increment flag, you've not got lots of tables which now have records with an id of 0 instead of sequential numbers ... this probably has also affected all your customers and orders, as well as products, etc ... whatever has been added since you imported this damaged data
c) and now you can't just flip the field to be auto-increment and fix the primary key, because you've got records in those tables that have duplicate (non-unique) values: ie: multiple records with 0 as the id. Not only is 0 invalid for an auto-increment field, but if you have more than one 0 record then you've got duplicates ... all of which you need to clean up before you can fix the table-definition/structure.
So ... that's why I said to delete the records with layout_id of 0, then fix the table structure, then use the Reset Layout Boxes button to re-insert the records, which should then get real numbers instead of 0.
But, even if you do that, if you've got other tables with the same autoincrement problem, then you're going to have other ugly issues such as add-to-cart not working, sessions not working, unable to add new customers, unable to assign unique order numbers, customers getting the same order-id as other customers, and more.


Reply With Quote

