我有以下的PHP v.5.6.29PHP形式給出了成功的消息,但沒有在DB
<?php
// Connect to the database
include_once("php_includes/db_connect.php");
error_reporting(E_ALL);
ini_set("display_errors", 1);
// Gather the posted data into local variables
$m = $_POST['MRN'];
$l = $_POST['LastName'];
$f = $_POST['FirstName'];
$s = $_POST['SSN'];
// Get user IP Address
$ip = preg_replace('#[^0-9.]#', '', getenv('REMOTE_ADDR'));
// Form data error handling
if($m == "" || $l == "" || $f == "" || $s == ""){
echo "The form submission is missing data.";
} else {
// End form data error handling
$sql = "INSERT INTO nys_demographics (mrn, pt_last_name, pt_first_name, pt_ssn, ip_address, record_insert_dtime)
VALUES('$m', '$l','$f','$s','$ip',now()";
mysqli_query($db_connect, $sql);
echo "insert success";
}
header("refresh:3; url=demographics.php");
?>
我得到了成功的消息,但再沒有什麼在db表。不知道從這裏做什麼。
在我的SQL語法中出現了一個錯誤...如果我關閉了VALUES語句中的parens ......需要咖啡因, –
可能會發生:),爲什麼使用PDO和準備好的語句[某些閱讀]更好(http://php.net/manual/en/mysqlinfo.api.choosing.php) –