Hi!

I have written this piece of PHP to check and update a mysql table but it's just not working. It is retrieving the information fine and showing it in the inputs/textareas but it is not updating the table when I click submit. It just shows my message for when the sql hasn;t worked (i.e. "Page not saved...") Any ideas? Please help!

Code PHP:
<?php
    $getSql = @mysql_query("SELECT * FROM site_settings LIMIT 4");
    if (!$getSql) {
        exit ("<p>Error retrieving site settings:" . mysql_error() . "</p>\n\n");
    }
    while ($siteSettings = @mysql_fetch_array($getSql)) {
        $pageId = $siteSettings['id'];
        $pageRef = $siteSettings['ref'];
        $pageTitle = $siteSettings['pagetitle'];
        $pageDescription = $siteSettings['pagedescription'];
        $pageKeywords = $siteSettings['pagekeywords'];
 
        if (isset($_POST['submit'.$pageId])) {
            $pageId = $_POST['pageId'];
            $pageTitle = $_POST['pageTitle'];
            $pageDescription = $_POST['pageDescription'];
            $pageKeywords = $_POST['pageKeywords'];
            $updateSql = mysql_query("UPDATE site_settings SET pagetitle='$pageTitle', pagedescription='$pageDescription', pagekeywords='$pageKeywords') WHERE id='$pageId' LIMIT 1");
            if (!$updateSql) {
                echo ("<p class='notify'><b>Page editing not saved!</b>\n".
                    "Please <a href='javascript:history.go(-1)'>try again</a> or notify the webmaster\n\n</p>");
            } else {
                echo "<p class='notify'><b>Page updated!</b></p>\n";
            }
        }
 
        echo "<h3>$pageRef</h3><form method='post' action='".$_SERVER[PHP_SELF]."'>".
            "<label for='pageTitle'>Page Title</label><input name='pageTitle' type='text' value='$pageTitle' size='53' />".
            "<label for='pageDescription'>Page Description</label><textarea name='pageDescription' cols='40' rows='3'>$pageDescription</textarea>".
            "<label for='pageKeywords'>Page Keywords</label><textarea name='pageKeywords' cols='40' rows='3'>$pageKeywords</textarea>".
            "<input type='hidden' name='pageId' value='$pageId' />".
            "<input type='submit' value='Save $pageRef Settings' name='submit$pageId' class='submit' /><hr class='hr1' /></form>";
 
    }
 
?>