Forums / General Questions / Adding New Products makes NULL Product_id

Adding New Products makes NULL Product_id

Views: 475

Results 1 to 3 of 3
3 Oct 2011, 1:36 PM
#1
vetpro avatar

vetpro

New Zenner

Join Date:
Oct 2011
Posts:
15
Plugin Contributions:
0

Adding New Products makes NULL Product_id

Hello All,
I have google searched this and can not find any answers.

Something has happened where, when I try to add a new product, after I click on Preview, then Insert...
The product doesn't appear in the list (category of where I added it).
So then I check using PHPMYADMIN to see what is going on and I
have 165 products listed, the 166th one has Products_Id is NULL (ie. It says NULL) instead of 166
All the product info is there, but the Products_Id is NULL... obviously it won't show anywhere on the site.

I have checked the other 2 tables that have to be the same and they have 0 (zero) in the Products_Id field.

When I try to add another product, it now comes up automatically with this Corrupt product details and if I add it again, it puts another load of details in the Fields with a NULL Products_Id again.
Please help.

Using the latest version

3 Oct 2011, 1:56 PM
#2
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,515
Plugin Contributions:
176

Re: Adding New Products makes NULL Product_id

Sounds like you've lost the auto_increment setting in the database for the products_id field on your products table. That sort of thing generally only happens when doing an export/import of the database when changing servers and changing MySQL versions at the same time, or when someone is tampering with the database structure without sufficient understanding of the impact of messing around.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

3 Oct 2011, 2:13 PM
#3
vetpro avatar

vetpro

New Zenner

Join Date:
Oct 2011
Posts:
15
Plugin Contributions:
0

Re: Adding New Products makes NULL Product_id

Hello,

Thankyou very much for this... Yes I actually just figured it out and came back here to post the answer. You are absolutely correct, the auto-increment got buggered up for some reason.
I made it a primary key and set it to auto-increment and all good now.
Thankyou.