Woo! It's working, oddly, but its working. I had a few more syntax errors and my loop was a little off but I managed to sort it out. I have one more question though. I'm inserting in a new `order` with a value of 3. Therefore it should be updating the old 3 to 4, 4 to 5, and 5 to 6. However, its decided now that it's going to update the old 3 to 8, and therefore 4 to 9 and 5 to 10. Any ideas?
<?php
include("../include/session.php");
if($session->logged_in){
$name = $_GET['name'];
$ID_CAT = $_GET['ID_CAT'];
$navi = $_GET['navi'];
$body = $_GET['body'];
$order = $navi + 1;
$Update = ">=$order";
$query = "SELECT `order` FROM `pages`";
$result = mysql_query($query) or die(mysql_error());
while($row = mysql_fetch_array($result)){
mysql_query("UPDATE `pages` SET `order`= (`order`+ 1) WHERE `order` $Update")
or die(mysql_error());
}
mysql_query("INSERT INTO `pages`
(`name`, `ID_CAT`, `order`, `body`) VALUES('$name', '$ID_CAT', '$order', '$body')")
or die(mysql_error());
echo "Your page has been successfully uploaded into the database and will now appear on the site.";
}
?>