Here is a clip Right out of the php manual.
mysql_query() returns TRUE (non-zero) or FALSE to indicate whether or not the query succeeded. A return value of TRUE means that the query was legal and could be executed by the server. It does not indicate anything about the number of rows affected or returned. It is perfectly possible for a query to succeed but affect no rows or return no rows.
This Means that in you update statement you will always have a result if your code is good, but the update fails so the
if(!$result){ statement should not work anyway. Perhaps if you checked for the number of rows effected using the mysql_afeected_rows() function. You can find information on that here: http://www.php.net/manual/en/function.mysql-affected-rows.php
I am assuming, of course, that you are refering to this section of the code:
$sql = "update sub_cat set sub_cat_n='$sub_cat_n1', catagory='$catagory1' where sub_cat_n='$sub_cat_n'";
$result = mysql_query($sql,$db);
if(!$result){
echo mysql_error();
}
else{
echo"<center>Rename sub catagory to $sub_cat_n1, has been done$b</center>";
}
Hope I helped, if not, I am prety new to programming so forgive me.
ALfred