I'm trying to update a row in my database but it's not running.
Below is the current script I have that gets values from an ajax call. I've checked the call and it is sending the right information. know that I do have the connection values at the top of the script but did not include them here.
// Opens a connection to a MySQL server
$connection = mysql_connect($host, $username, $password);
if (!$connection) {
die("Not connected : " . mysql_error());
} // Set the active MySQL database
$db_selected = mysql_select_db($database, $connection);
if (!$db_selected) {
die("Can\'t use db : " . mysql_error());
}
// Store INFORMATION
$name = $_POST['name'];
$website = $_POST['website'];
$address = $_POST['address'];
$request_url = $base_url . "&q=" . urlencode($address);
$csv = file_get_contents($request_url) or die("url not loading");
$csvSplit = split(",", $csv);
$status = $csvSplit[0];
$lat = $csvSplit[2];
$lng = $csvSplit[3];
$state = $_POST['state'];
$ident = $_POST['ident'];
$query = "UPDATE markers SET name = '".$name."', website = '".$website."',address = '".$address."',lat = '".$lat."',lng = '".$lng."',state = '".$state."'WHERE id = '" . $ident . "'";
mysql_query($query) or die(mysql_error());
?>
I'm still very new at this, can someone explain why it's not working?
mysql_real_escape_string