Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Shopping cart malfunction?

Status
Not open for further replies.

timmy321

Programmer
Feb 2, 2007
1
US
I recently had a program written in php for e-commerce, but there seems to be a problem with the posting of the cart id to the SQL table. The designer is no longer available for questions, so I had hoped to get some help here. I have a brief knowledge of php, but just cant seem to track the problem down. There are two tables used for the cart:

store_shopping_cart and
store_shopping_cart_items

Everything works fine until you try to add an item to the cart. It tries to enter a null value into store_shopping_cart_items for the column shopping_cart_id

The shopping cart obviously cannot be null or there could be major confusion between different customers.

I know you need more information and to look at the code to give me an answer, but there are many dependent php files (classes.php,common.php, etc.) I didn't want to post them all here and waste a bunch of space.

Could some1 contact me and help me track this problem down? I'd like to get the site up and working asap because its a much better design than our current site.

Thanks
Timmy
TimmyC@5thavenuebling.com
 
it is common practice to insert NULL into a column that has the auto_increment flag. mysql will increment the id automatically.

please do not include your email address in forum posts. you should red-flag your post and ask the mods to delete the address.
 
Or don't pass. Auto_increment fields don't need to be included in the INSERT command, but you have to place all the field names between table name and the Values tag.

Anikin
Hugo Alexandre Dias
Web-Programmer
 
i'm not a fan of implicitly allowing auto_increment fields to update. for reasons of code maintainability, i would rather always use random id's or expressly pass a null or empty string. for the same reason i tend to use the set field=value syntax.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top