Skatan Posted June 15, 2010 Share Posted June 15, 2010 I'm in a start-up and planing mode and come to a problem, that for me is should be a pretty basic thing but I can't find any solution at Google: Profile table ProfileID Company name Order table: OrderID ProfileId OrderQuanity OrderDesc I want when a user make a order, that the orderID is based on the own auto_increment, so it's not based on all orders, just the own history of orders. I first tired to set PRIMARY KEY to both OrderID and ProfileID in the order table, but that dosn't work togheter with having auto_increment on OrderID. Data could be like this: Profiles 1, BEACH STORE LTD 2, MUMY&PAPY Soho LTD Order: OrderID.....ProfileId....OrderDesc 1 ............. 1.............100 ice creams 2 ............. 1.............shorts 3 ............. 1.............hot shots 1 ............. 2............. pizza 2 ............. 2............. frozen margerita 3 ............. 2............. slush pumps I want to know if this is possible to do this in the database structure and not in by coding. I'm using MySQL Quote Link to comment https://forums.phpfreaks.com/topic/204834-restart-auto_increment-id-for-each-new-user/ Share on other sites More sharing options...
Mchl Posted June 15, 2010 Share Posted June 15, 2010 It is possible in MyISAM tables: http://dev.mysql.com/doc/refman/5.0/en/example-auto-increment.html Although I'd advise against it. Just keep auto_increment value for all orders. If you want to count how many orders given user has made, you can do this in other ways. Quote Link to comment https://forums.phpfreaks.com/topic/204834-restart-auto_increment-id-for-each-new-user/#findComment-1072311 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.