Hi all, I've been playing with this for a few hours now (over the course of a couple of days) and it's getting frustrating!
All I want to do is to be able to make one row in the database set the order that my categories appear on my website. Now I can do this fine simply by using ORDER_BY but I want to have my users be able to update the order through an admin page like so: ------------------------------------- Catid | catname | catdesc | catorder | 1 name desc 1 2 name desc 2 3 name desc 3 4 name desc 4 ______________________________________ Basically I have a form which takes data from the table above and displays catname (just echoed) and catorder in a text form field. When I submit the form I want to update catorder with whatever number the user puts in the field. Currently my code updates only one of the category order numbers. So my form code: <form action="eshop_processcatorder.php" method="post"> </td></tr> <? while ($array = mysql_fetch_array($mysql)) { echo "<tr><td width='150'><span class='adminisoleipa'>"; echo "{$array["catname"]}"; echo "</td><td><input type='text' size='2' name='catorder[{$array["catid"]}]' value='{$array["catorder"]}'>"; echo "</span></td></tr>"; } ?> <tr><td><br> <input type="submit" name="Submit" value="Submit" class="nappi"> </form> That does everything I need it to do. However what am I doing wrong when I try to process it using this code? foreach($_POST["catorder"] as $catid => $catorder) { $query = "update categories set catorder=$catorder where catid=$catid"; } $result = mysql_query($query) or die("Query failure: " .mysql_error()); if (!$result) { echo "<table width='100%' border='0' cellspacing='0' cellpadding='0' align='center' bgcolor='#629D39'>"; echo "<tr><td><img src='images/admin_orders_administrate.gif'></td></tr>"; echo "<tr><td> </td></tr>"; echo "<tr><td><span class='adminisoleipa'>Could not change details: please <a href='mailto:[EMAIL PROTECTED]'>click here</a> to email the administrator<br><br></span>"; echo "</td>"; echo "</tr>"; echo "</table>"; } else { echo "<table width='100%' border='0' cellspacing='0' cellpadding='0' align='center' bgcolor='#629D39'>"; echo "<tr><td><img src='images/admin_orders_administrate.gif'></td></tr>"; echo "<tr><td> </td></tr>"; echo "<tr><td><span class='adminisoleipa'>The category page has had the order in which categories appear changed.<br><br></span>"; echo "</td>"; echo "</tr>"; echo "</table>"; } Any help appraciated. Kind regards, Steve Jackson Web Developer Viola Systems Ltd. http://www.violasystems.com [EMAIL PROTECTED] Mobile +358 50 343 5159 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php