$department = $_POST['Department'];
$street=$_POST['streetaddress'];
$qualification=$_POST['Qualification'];
$Nmc=$_POST['Nmc'];
$day=$_POST['day'];
$month=$_POST['month'];
$year=$_POST['year'];
$date = "{$year}-{$month}-{$day}";
$BloodType=$_POST['Bloodtype'];
$dataFile= $_FILES ['dataFile'] ['name'];
$photo_size=$_FILES['dataFile']['size'];
$photo_type=$_FILES['dataFile']['type'];
if($photo_size<500000 && $photo_type=="image/jpeg" || $photo_type=="image/jpg" || $photo_type=="image/png" || $photo_type=="image/gif"){
$explode_values=explode('.',$dataFile);
$frontuniquename=sha1($explode_values[0].time());
$final_photo_name=$frontuniquename.'.'.$explode_values[1];
if(move_uploaded_file($_FILES['dataFile']['tmp_name'],"../images/Doctor/".$final_photo_name)){
$sql= " INSERT INTO doctor_details (`ContactNumber`, `Qualification`, `Department`, `Nmc_regd_no`, `Did`, `Age`, `weight`, `Bloodtype`, `photo`, `Date`)
VALUES ('$contact_no','$qualification', '$department','$Nmc','$id,'$age','$weight','$BloodType','$final_photo_name','$date')";
}
我的php Post值无法传输到我的MySQL数据库。每当我回显我的值时,都无法将其插入Mysql数据库中。
答案 0 :(得分:0)
要改进代码的几点要点: 1.必须转存到数据库的所有变量。根据您的数据库,可以采用不同的方法。例如,对于MySQL:http://php.net/manual/en/function.mysql-real-escape-string.php
A && (B || C || D)
很遗憾,您的代码没有向服务器发送任何请求。例如,MySQL INSERT的执行方式如下:https://www.w3schools.com/php/php_mysql_insert.asp