ajax返回成功但mysql db没有更新

I have a javascript for loop that sends an array to an ajax page to update the mysql database.

I echo the result back to the original page and it echos as a success but when I check the db nothing has changed

my javascript for loop that sends the array

for(var m=0; m<array.length; m++){
    $.post("update_page_positions.php",{page_ref:array[m][0], ref:array[m][12], menu_pos:array[m][1], sub_menu_pos:array[m][2], top_menu:array[m][3], pagelink:array[m][4], indexpage:array[m][5], hidden:array[m][6], page_title:array[m][7], page_desc:array[m][8], page_keywords:array[m][9], page_name:array[m][10], deletedpage:array[m][11]},         
        function(data,status){  
            alert("data="+data+" status="+status);   
});                 

here is the php ajax page the updates the db

<?
    include("connect.php");     
    $ref = $_POST['ref'];
    $page_ref = $_POST['page_ref'];
    $menu_pos = $_POST['menu_pos'];
    $sub_menu_pos = $_POST['sub_menu_pos'];  
    $top_menu = $_POST['top_menu'];
    $indexpage = $_POST['indexpage'];       
    $page_name = $_POST['page_name'];    
    $page_title = $_POST['page_title'];
    $page_desc = $_POST['page_desc'];   
    $page_keywords = $_POST['page_keywords'];   
    $hidden = $_POST['hidden']; 
    $pagelink = $_POST['pagelink']; 
    $deletedpage = $_POST['deletedpage'];   

    $query = mysql_query("SELECT * FROM pages WHERE ref='$ref' AND page_ref='$page_ref'");

 if(mysql_num_rows($query)==0){
    mysql_query("INSERT INTO pages(page_ref, ref, page_name, menu_pos, sub_menu_pos, top_menu, link, indexpage) VALUES('$page_ref','$ref','$page_name','$menu_pos','$sub_menu_pos','$top_menu','$pagelink','$indexpage')");
}

 if($deletedpage=="1"){
        mysql_query("DELETE FROM pages WHERE ref='$ref' AND page_ref='$page_ref'");         
        mysql_query("DELETE FROM site_content WHERE ref='$ref' AND page_ref='$page_ref'");
 } 
 else{       
       if(mysql_query("UPDATE pages SET menu_pos='$menu_pos', sub_menu_pos='$sub_menu_pos', top_menu='$top_menu', indexpage='$indexpage', page_name='$page_name', page_title='$page_title', desc1='$page_desc', keywords_list='$page_keywords', hidden='$hidden', link='$pagelink' WHERE ref='$ref' AND page_ref='$page_ref'")){

        echo "updated!";
     } else{
        echo "error";           
      }

 }   
?>

the INSERT and DELETE functions are fine but the UPDATE returns a success statement but does not update the db.

Can anyone see what the problem is?

Posted as an answer because the comment was too hard to read:

Rather than echoing "updated", try echoing

"UPDATE pages SET menu_pos='$menu_pos', sub_menu_pos='$sub_menu_pos', top_menu='$top_menu', indexpage='$indexpage', page_name='$page_name', page_title='$page_title', desc1='$page_desc', keywords_list='$page_keywords', hidden='$hidden', link='$pagelink' WHERE ref='$ref' AND page_ref='$page_ref'"

(ie. the query you're trying to run).

See if that gives you some clues.

UPDATE reports success, but does nothing in case when its WHERE clause rejects all rows in updated table.

Maybe $page_ref identifier is correct (so DELETE works), but full $page_ref and $ref combination is not?