Post and query mysql database
<p>on one page I have the following code:</p>

<pre><code>$("#photolist").dragsort({
    dragBetween: true,
    dragEnd: saveOrder,
    placeHolderTemplate: "&lt;li class='placeHolder'&gt;&lt;div&gt;&lt;/div&gt;&lt;/li&gt;"
});

function saveOrder() {
    var data = $("#photolist li").map(function() {
        return $(this).children().find('img').attr('id');
    }).get();

    $("input[name=SortOrder]").val(data.join("|"));
    var map =  $('input[name=SortOrder]').val();
    $.ajax({
        type: 'POST',
        url: 'updatephotoposition.php',
        data: "map=" + map,
        success: function(){  
            alert("success");
        }
    });
};
</code></pre>

<p>It is definitely firing because the alert is functioning.</p>

<p>on my page updatephotoposition.php I use the following code:</p>

<pre><code>&lt;?php
include '../dbconnect.php';
$map = explode('|', $_POST['map']);
foreach ($map as $position =&gt; $ID)
{
    $query = "UPDATE Photos SET Position = '$position' WHERE PhotoID = '$ID';";
    $result = mysql_query($query) or die(mysql_error());
}
?&gt;
</code></pre>

<p>But my database isn't getting updated, can anyone see a problem with this set up?</p>

<p>Post data sent: <code>82|83|84|85|86|81|87|88|89</code></p>

<p>EDIT: This has suddenly started working</p>
