Skip to content

Instantly share code, notes, and snippets.

@evanscottgray
Last active January 4, 2016 15:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save evanscottgray/8641005 to your computer and use it in GitHub Desktop.
Save evanscottgray/8641005 to your computer and use it in GitHub Desktop.
<?php
require 'core/init.php';
$pk = $_POST['pk']; //primary key aka ID
$name = $_POST['name']; //name of the field
$value = $_POST['value']; //value of the field
echo $pk
echo $name
echo $value
if (!empty($value)){
echo escape($value);
$result = mysql_query('UPDATE Restaurants SET '.mysql_escape_string($name).'="'.mysql_escape_string($value).'" where r_id = "'.mysql_escape_string($pk).'"');
print_r($_POST);
} else {
header('HTTP 400 Bad Request', true, 400);
echo "This field is required!";
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment