Unstoppable Domains

[PHP + MYSQL] primary key start at 5000?

Spaceship Spaceship
Watch
Impact
38
Hi people,

Can someone turn this into a function for me?

PHP:
		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];

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

			mysql_query($sql);

		}

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/oahuprinting/dev/cutup/source/view_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:
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
.US domains.US domains
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
 
0
•••
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=[COLOR=Red]5000[/COLOR] ;
 
1
•••
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!
 
0
•••
Appraise.net

We're social

Domain Recover
NameMaxi - Your Domain Has Buyers
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back