从一个窗体到表中的两个连续行


Two consecutive rows into a table from one form

我对一个表单有点问题,该表单必须将图片发送到特定文件夹中,然后将图片名称以及其他详细信息(如姓名、电子邮件、电话、密码)存储到数据库中。

所有操作都很好,有一个小问题,当我发送表单时,数据库中有两个不同的行,具有不同的id,第一行中除了md5密码字段外,所有字段都是空的,第二行中是我发送到数据库中的所有信息的所有字段。下面是我正在使用的代码。

 $target = "../uploads/"; 
 $target = $target . basename( $_FILES['photo']['name']); 
 $name = $_POST['name']; 
 $email = $_POST['email']; 
 $telefon = $_POST['telefon'];
 $password = md5($_POST['password']); 
 $photo = ($_FILES['photo']['name']);
 $result = $mysqli->query("INSERT INTO imobiliare_agenti (id, name, email, telefon,    password, photo) VALUES ('$id', '$name', '$email', '$telefon', md5('$password'), '$photo')") ; 
 if(move_uploaded_file($_FILES['photo']['tmp_name'], $target)) 
{ 
 echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded,    and your information has been added to the directory"; 
 } 
 else { 
 echo "Sorry, there was a problem uploading your file."; 
 } 

在php中添加了

$password = md5($_POST['password']); 

在查询中,您再次添加了mysql md5函数。

"插入imobiliare_agenti(id,name,email,telefon,password,photo)值('$id','$name','$semail','$Stelefon',md5('$password'),'$photo')"

请尝试删除其中一个md5函数。