I have this php code that updates a row in my MySQL database, based on 3 variables sent with ajax but that returns a http 500 error:
<?php
$dbname = 'xxxxxxxxxx';
$dbuser = 'xxxxxxxxxxxx';
$dbpass = 'xxxxxxxxxxxxx';
$dbhost = 'xxxxxxxxx';
$link = mysql_connect($dbhost, $dbuser, $dbpass) or die("Unable to Connect to '$dbhost'");
$db_selected = mysql_select_db($dbname, $link);
if (!$db_selected) {
    die ('Can\'t use foo : ' . mysql_error());
}
$topparent = $_POST['name']; 
$column = $_POST['column']; 
$value = $_POST['value']; 
$sql = "UPDATE reloaded SET" . $column . " = '" .$value . "'WHERE top_parent = '" . $name ."';
$retval = mysql_query( $sql, $link );
         if(! $retval ) {
            die('Could not create table: ' . mysql_error());
         }
         echo "success\n";
         mysql_close($link);
?>
My jquery js is this. The variables get passed correctly (tried with alert):
function updatedb(a,b,c){
    $.ajax({
       url: "updatedb.php",
       type: 'POST',
       data: ({name:a,column:b,value:c}),
       success: function(msg) {
          alert('DB updated');
       }               
    });
};
Any idea why it returns an error? I have spent some time going over the code, trying different variations but can't seem to figure it out.
 
     
    