Last active
January 4, 2016 15:29
-
-
Save evanscottgray/8641005 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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