Thanks for your help guys, still not sure how i would do this though.....Perhaps I should explain my situatuion:Ok so i have a db table named "page" in that table there are several columns, and one of them is named "order".....I have a script for updating the order column but its not working as it should. All rows get the same value, thats the problem. this is my script:
echo "<form action='page.php?action=order' method='POST'>"; $sql = "SELECT * FROM `page` ORDER BY `id` DESC"; $result = mysql_query($sql) or die(mysql_error()); while ($row = mysql_fetch_object($result)) { echo "<input type='text' name='order[$row->id]' value='$row->order'>"; } echo "<input type='submit' value='save'></form>";
In page.php?action=order:
$sql = "SELECT * FROM `page` ORDER BY `id` DESC"; $result = mysql_query($sql) or die(mysql_error()); while ($row = mysql_fetch_object($result)) { $insert = $_POST["order[$row->id]"]; $sql = "UPDATE `page` SET `order` = `$insert` ORDER BY `id` DESC"; mysql_query($sql) or die(mysql_error()); }
This does not work as it should, what do I need to change?Thanks in advanceNiklas