NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming
Reload this Page [PHP + MYSQL] primary key start at 5000?

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.

Advanced Search
5 members in live chat ~  


Closed Thread
 
LinkBack Thread Tools
Old 01-30-2007, 12:00 PM THREAD STARTER               #1 (permalink)
NamePros Regular
 
DylanButler's Avatar
Join Date: Jan 2006
Location: San Diego, CA
Posts: 734
DylanButler is a splendid one to beholdDylanButler is a splendid one to beholdDylanButler is a splendid one to beholdDylanButler is a splendid one to beholdDylanButler is a splendid one to beholdDylanButler is a splendid one to beholdDylanButler is a splendid one to beholdDylanButler is a splendid one to behold
 



[PHP + MYSQL] primary key start at 5000?


Hi people,

Can someone turn this into a function for me?

PHP Code:
        if ($row[authcode] != $_POST["authcode" $counter]) {

            
$row[authcode] = $_POST["authcode" $counter]; // authcode . $counter is the name of the input / select option that has been modified.

            
$newauthcode $row[authcode];
????: NamePros.com http://www.namepros.com/programming/288113-php-mysql-primary-key-start-5000-a.html

            
$sql "UPDATE `order` SET authcode='$newauthcode' WHERE id='$row[id]'";

            
mysql_query($sql);
????: NamePros.com http://www.namepros.com/showthread.php?t=288113

        } 
This function should allow me to update any field from the $row array easier. Is this the best way to update fields? I did it this way so that if nothing is updated on 95% of the tables, then the query won't be run for them.

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.
DylanButler is offline  
Old 01-30-2007, 12:38 PM   #2 (permalink)
Senior Member
Join Date: Dec 2006
Location: England
Posts: 1,565
Matthew. has much to be proud ofMatthew. has much to be proud ofMatthew. has much to be proud ofMatthew. has much to be proud ofMatthew. has much to be proud ofMatthew. has much to be proud ofMatthew. has much to be proud ofMatthew. has much to be proud ofMatthew. has much to be proud of
 


Adoption Breast Cancer Breast Cancer Cancer Survivorship
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
Matthew. is offline  
Old 01-30-2007, 12:41 PM   #3 (permalink)
Domains my Dominion
 
sdsinc's Avatar
Join Date: Aug 2005
Location: Web 1.0
Posts: 9,963
sdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatness
 


Third World Education Find Marrow Donors! Find Marrow Donors! Find Marrow Donors! Find Marrow Donors! Animal Rescue Animal Cruelty AIDS/HIV Animal Rescue Wildlife Breast Cancer Animal Rescue Wildlife
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
sdsinc is offline  
Old 01-30-2007, 12:48 PM THREAD STARTER               #4 (permalink)
NamePros Regular
 
DylanButler's Avatar
Join Date: Jan 2006
Location: San Diego, CA
Posts: 734
DylanButler is a splendid one to beholdDylanButler is a splendid one to beholdDylanButler is a splendid one to beholdDylanButler is a splendid one to beholdDylanButler is a splendid one to beholdDylanButler is a splendid one to beholdDylanButler is a splendid one to beholdDylanButler is a splendid one to behold
 



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!
DylanButler is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


 
All times are GMT -7. The time now is 02:19 PM.

Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger