| | |||||
| ||||||||
| Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics. |
![]() |
| | LinkBack | Thread Tools |
| | THREAD STARTER #1 (permalink) |
| NamePros Regular Join Date: Jan 2006 Location: San Diego, CA
Posts: 734
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | [PHP + MYSQL] primary key start at 5000? Hi people, Can someone turn this into a function for me? PHP Code: View the entire page source here: http://www.dylanbutler.com/client/oa...ew_orders.phps You'll see I've got 4 different user levels (0 - 3). Level 0 users see the least amount of items, whereas an administrator (level 3) can modify / delete pretty much anything. Please simplify lines 519-613 into a usable function so I can just plug in the row names rather than the whole logic over and over again. Does this make sense?
Last edited by DylanButler; 01-30-2007 at 12:50 PM.
|
| |
| | #2 (permalink) |
| Senior Member Join Date: Dec 2006 Location: England
Posts: 1,565
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | You can do it by manually editing each inserted ID however that's not the best way like you say. My advice is to go into phpmyadmin, go to the chosen database/table (orders), go to operations and change the "auto_increment" value to 5000. That should start it off at 5000 like your require without any script adjustments. As for the second question, im not 100% sure of what you are asking so ill leave it ![]() Matt |
| |
| | #3 (permalink) |
| Domains my Dominion Join Date: Aug 2005 Location: Web 1.0
Posts: 9,963
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | If you want the ID field to increment with a value different than 1 you can use a custom CREATE TABLE statement like this: Code: CREATE TABLE #### ( ... PRIMARY KEY (####) ) AUTO_INCREMENT=5000 ;
__________________ NameNewsletter.com - free lists of available domain names ZoneFiles.net (beta) - ccTLD and gTLD droplists |
| |
| | THREAD STARTER #4 (permalink) |
| NamePros Regular Join Date: Jan 2006 Location: San Diego, CA
Posts: 734
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | Thanks both of you guys for your faster than fast response. That worked perfect. I've got one more problem and I've posted my source code and the objective for that one if you don't mind. I really appreciate it guys and +REP added! |
| |