Guest Posted March 7, 2007 Share Posted March 7, 2007 Is it posibly to change or edit the Order number? If it is posibly...how? Link to comment Share on other sites More sharing options...
davidinottawa Posted March 7, 2007 Share Posted March 7, 2007 Is it posibly to change or edit the Order number? If it is posibly...how? Sure - why would you want to ? Use phpMyAdmin --> Orders table --> Browse --> Edit the record you want to change. Or - use SQL in phpMyAdmin and run : update orders set orders_id = <new number> where orders_id = <old number> i.e. : update orders set orders_id = 8888 where orders_id = 9999 david Link to comment Share on other sites More sharing options...
ozEworks Posted March 7, 2007 Share Posted March 7, 2007 Don't do that. Orders are in fact a number of tables and if you update the order number in one and not in the others you are breaking the link between them. Better to tell us WHY you want to do it and then someone can advise you better Link to comment Share on other sites More sharing options...
davidinottawa Posted March 7, 2007 Share Posted March 7, 2007 Don't do that. Orders are in fact a number of tables and if you update the order number in one and not in the others you are breaking the link between them. Better to tell us WHY you want to do it and then someone can advise you better Of course - but he simply asked if it is possbile. Of course it's possible - stupid but possible!!! The tables should have a cascade effect anyway. They do on the delete function - I've never tested the update function. Link to comment Share on other sites More sharing options...
ozEworks Posted March 7, 2007 Share Posted March 7, 2007 I have yet to see a version of phpmyadmin that will delete all tables related to a table if you delete it. It certainly does not update them. Link to comment Share on other sites More sharing options...
davidinottawa Posted March 7, 2007 Share Posted March 7, 2007 I have yet to see a version of phpmyadmin that will delete all tables related to a table if you delete it. It certainly does not update them. This has nothing to do with phpMyAdmin - it has to do with how the SQL is formed when the tables are initially created. And it doesn't delete tables - it deletes and updates related foreign_key records based on the primary key in the parent table. If you create two tables using the CASCADE DELETE UPDATE parameters then all updates and deletes on a single primary key will also affect any related records in the child table(s) For example : CREATE TABLE parent { id serial PRIMARY KEY UNIQUE, first_name varchar(100) } CREATE TABLE child { childone int, childtwo int, fk_childID int REFERENCES parent(id) ON UPDATE CASCADE ON DELETE CASCADE } Now to delete a record from the parent table, you run : delete from parent where id = 9999 This command while also delete the related record in the child table. Same goes if you run an update. david Link to comment Share on other sites More sharing options...
Guest Posted March 8, 2007 Share Posted March 8, 2007 Sure - why would you want to ? david Better to start with order no 1000 insted of 1... What would you think if you bought anything from an internet site, and when you get your order confirmation is says order number 1003, nobody would even think of it... But if it says... order numer 3, hmm...is this really a serious site? I am customer numer 3...! Thats why... :-" Also, it could be of use to be able to reset the order number to zero ( or 1000 ) at the 1st of january to start over? But as what I understan there are no easy function for this? Link to comment Share on other sites More sharing options...
davidinottawa Posted March 8, 2007 Share Posted March 8, 2007 Better to start with order no 1000 insted of 1... What would you think if you bought anything from an internet site, and when you get your order confirmation is says order number 1003, nobody would even think of it... But if it says... order numer 3, hmm...is this really a serious site? I am customer numer 3...! Thats why... :-" Also, it could be of use to be able to reset the order number to zero ( or 1000 ) at the 1st of january to start over? But as what I understan there are no easy function for this? Well - I'm sorry to be blunt - but this is a really stupid idea. If you expect your site to run automatically for years and years - then do not touch this primay key in this way. If a user places an order, their automated email will have the link to their order. If you change it on him and he goes to check the status of the order, it will be a dead link - and he'll not be happy. If you choose to go through with this, then you wuold need to create a linked lookup table that would contain three columns - a primary key, the old id number and the new id number - and this table would need to be referenced every time anyone at any time pulls up an order - admin side or otherwise. If you want to alter your table to have order id's start at 1000, then all you have to do is run this : alter table orders auto_increment = 1000 As FlyingKites said to you earlier : "Better to tell us WHY you want to do it and then someone can advise you better" Your initial post should have read : How can I start my orders numbers at 1000 instead of 0 ? Post what you want to *accomplish* - and you'll get better and more accurate responses. david Link to comment Share on other sites More sharing options...
Guest Posted April 18, 2007 Share Posted April 18, 2007 Better to tell us WHY you want to do it and then someone can advise you better[/i]" Your initial post should have read : How can I start my orders numbers at 1000 instead of 0 ? Post what you want to *accomplish* - and you'll get better and more accurate responses. david Okay, Thank you... I just want my webshop to start order number from 1000 alter table orders auto_increment = 1000 How and were can I do this? The order number are now up at 34, will there be any problems if I change this now when the order number is already counting?? Do I need to set it to zero first or something??? Link to comment Share on other sites More sharing options...
Guest Posted April 18, 2007 Share Posted April 18, 2007 Better to tell us WHY you want to do it and then someone can advise you better[/i]" Your initial post should have read : How can I start my orders numbers at 1000 instead of 0 ? Post what you want to *accomplish* - and you'll get better and more accurate responses. david Okay, Thank you... I just want my webshop to start order number from 1000 alter table orders auto_increment = 1000 How and were can I do this? The order number are now up at 34, will there be any problems if I change this now when the order number is already counting?? Do I need to set it to zero first or something??? Link to comment Share on other sites More sharing options...
davidinottawa Posted April 18, 2007 Share Posted April 18, 2007 Okay, Thank you... I just want my webshop to start order number from 1000 alter table orders auto_increment = 1000 How and were can I do this? The order number are now up at 34, will there be any problems if I change this now when the order number is already counting?? Do I need to set it to zero first or something??? You shouldn ot have to do anything excpet run this sql statement. Login to your control panel with your host, find MySQL Databases, go into phpMyAdmin, select the SQL tab, dump this in there : alter table orders auto_increment = 1000 and hit Go. Link to comment Share on other sites More sharing options...
Guest Posted April 18, 2007 Share Posted April 18, 2007 You shouldn ot have to do anything excpet run this sql statement.Login to your control panel with your host, find MySQL Databases, go into phpMyAdmin, select the SQL tab, dump this in there : alter table orders auto_increment = 1000 and hit Go. Thank you for a fast answer! Okay... I understand how to do it...but.... is this safe? Would be a nightmare if something bad happened :'( Link to comment Share on other sites More sharing options...
dp1726 Posted April 20, 2007 Share Posted April 20, 2007 This might help http://www.oscommerce.info/kb/osCommerce/G...s_and_Tricks/31 DP Link to comment Share on other sites More sharing options...
Guest Posted April 20, 2007 Share Posted April 20, 2007 This might help http://www.oscommerce.info/kb/osCommerce/G...s_and_Tricks/31 DP Thanx! What of theses are correct? alter table osc_orders auto_increment = 1000; alter table osc_orders auto_increment = 1000 Link to comment Share on other sites More sharing options...
dp1726 Posted April 20, 2007 Share Posted April 20, 2007 the first one alter table osc_orders auto_increment = 1000; I think, I'm still trying to learn A site that might help is http://www.w3schools.com/php/default.asp Dave Link to comment Share on other sites More sharing options...
Guest Posted May 2, 2007 Share Posted May 2, 2007 It is not working for me.... :'( #1146 - Table 'space_webshop.osc_orders' doesn't exist Why?? Link to comment Share on other sites More sharing options...
Guest Posted May 3, 2007 Share Posted May 3, 2007 Anyone know what to do ?? :'( Link to comment Share on other sites More sharing options...
Guest Posted May 6, 2007 Share Posted May 6, 2007 Do anyone know why I get this error?? I wright exacley like this: alter table osc_orders auto_increment = 1000; It says: #1146 - Table 'space_webshop.osc_orders' doesn't exist Please... Link to comment Share on other sites More sharing options...
Guest Posted May 7, 2007 Share Posted May 7, 2007 ALTER TABLE `orders` AUTO_INCREMENT =1000 Link to comment Share on other sites More sharing options...
Guest Posted May 8, 2007 Share Posted May 8, 2007 ALTER TABLE `orders` AUTO_INCREMENT =1000 Thank you!! Do I wright excakley like this? Is it important to use big/small letters? ALTER TABLE `orders` AUTO_INCREMENT =1000 Just curious.... why does it say another way in the "tips and Tricks" ? osc_orders I am not very good at this, but like to learn! Thanks in advance. Link to comment Share on other sites More sharing options...
Guest Posted May 9, 2007 Share Posted May 9, 2007 .......anyone? Link to comment Share on other sites More sharing options...
stant Posted December 7, 2008 Share Posted December 7, 2008 You place order by yourself. Start phpMyAdmin Click orders on left table name. Chek last order number and then click Pen button. Edit orders_id like 1000 Next order automatically count from 1001. I did it, maybe it works for you too. Is it posibly to change or edit the Order number? If it is posibly...how? Link to comment Share on other sites More sharing options...
itsjust Posted January 3, 2010 Share Posted January 3, 2010 Ok this is an old post, but also a bit confusing so just to clear it up: In the oscommerce knowledge base (http://www.oscommerce.info/kb/31) they suggest to use this sql: alter table osc_orders auto_increment = 1000; And I assume that this is because at some point the database tabel name for orders was called "osc_orders". But if you as I use a newer version of oscommerce, then do the following. To change the ordernumbers to start at any number you want (here 1500), run the following sql: alter table orders auto_increment = 1500; p.s. There is no danger in running the old sql even if you have the newer version of oscommerce. It will only give you an error. Now I use this sql to change my order numbers every year, and if you do that, there is only one thing that you have to be careful about, and that is not to change it to a lower number. So if the last order number in your database is 2455, then do not change the order numbers to 2000, but to 3000 or something like this. I put the number of the year in front of my numbers, so every year I change the order number to 091000, 101000, 111000. If you have more than 8999 orders a year, then of course you have to set this number higher. Link to comment Share on other sites More sharing options...
germ Posted January 3, 2010 Share Posted January 3, 2010 Actually the article refers to the table as it exists in osC v3 Although I don't know that it says that anywhere. But it is nice of you to post your findings. I'm certain someone will read this and benefit from it. :) If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you. "Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice." - Me - "Headers already sent" - The definitive help "Cannot redeclare ..." - How to find/fix it SSL Implementation Help Like this post? "Like" it again over there > Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.