- Impact
- 38
Hi people,
Can someone turn this into a function for me?
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?
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:





