Unique ID number needed --- PLEASE HELP

Hello gentleman, I am looking for a way to have a unique id number for every “line item” within an order. This would mean for every unique item on a order there is a different unique identifying value. for example:



there is an order :id - 51155

this order has 3 items on it (lets say for now they are all with a quantity of one, that is a whole other issue).



each product has a product id that matches a manufacturer and model description etc.

there is no id number for each of those items within the order though.



this is what i see now

item id, order id, prod id, prod code etc…

what i would like to see is the addition of a column for the line id (which will be unique to ever line in my database.



does this make sense? if not i can explain it further.



Thank you in advance for any assistance.

[quote name=‘Markymrk’]Hello gentleman, I am looking for a way to have a unique id number for every “line item” within an order. This would mean for every unique item on a order there is a different unique identifying value. for example:



there is an order :id - 51155

this order has 3 items on it (lets say for now they are all with a quantity of one, that is a whole other issue).



each product has a product id that matches a manufacturer and model description etc.

there is no id number for each of those items within the order though.



this is what i see now

item id, order id, prod id, prod code etc…

what i would like to see is the addition of a column for the line id (which will be unique to ever line in my database.



does this make sense? if not i can explain it further.



Thank you in advance for any assistance.[/QUOTE]



I assume your talking about the table order_details



You could just add a new field in the database, call it something like auto_id and make it a INT with Auto Increment. It will create a unique number for each recorded added to that table.



Hope this helps

that sounds great. i am looking up this information for my boss, is there anyway that you could give me a bit of “how to” on this. Just a more specific go here and open this type of thing



thank you very much for your fast and useful response.

[quote name=‘Markymrk’]that sounds great. i am looking up this information for my boss, is there anyway that you could give me a bit of “how to” on this. Just a more specific go here and open this type of thing



thank you very much for your fast and useful response.[/QUOTE]



Without knowing what tools have available to you it’s a little hard to say. There is tons of resources available on the web. The db for CS-Cart is MySQL, and you need to ALTER the table. Here’s a link to the MySQL docs.



[url]http://dev.mysql.com/doc/refman/5.0/en/alter-table.html[/url]



Good Luck

[quote name=‘mclamais’]Without knowing what tools have available to you it’s a little hard to say. There is tons of resources available on the web. The db for CS-Cart is MySQL, and you need to ALTER the table. Here’s a link to the MySQL docs.



[url]http://dev.mysql.com/doc/refman/5.0/en/alter-table.html[/url]



Good Luck[/QUOTE]





I figured out how to add a column, however, it is giving me the following error message.





Failed to save field : SQL alter table cscart_order_details add line_id int not null default NULL auto_increment failed : Incorrect table definition; there can be only one auto column and it must be defined as a key



are you able to help at all?





there are no other columns in this database that have autoinc on it,



i made it as a key, it is just not workign…

thanks



Mark

Looks like you can only have 1 auto increment column per table. In which case, you cannot do what your looking to do.

[quote name=‘ETInteractive’]Looks like you can only have 1 auto increment column per table. In which case, you cannot do what your looking to do.[/QUOTE]



what is the other auto increment in this table?







i used to use oscommerce.



and i have an order_id (which was auto increment) and also an order_product_id which is kind of what i am looking for with cs-car (which was also auto increment)



it was also mysql database.



any ideas?



thanks



Mark