这个问题是在使用预准备语句将图像存储到数据库中时。还存储了其他所有内容。没有准备好的声明一切都很好。这是代码:
$submit=isset($_POST['submit']);
if($submit)
{
$name=$_POST['name'];
$email=$_POST['email'];
$phone=$_POST['phone'];
$school=$_POST['school'];
$father=$_POST['father'];
$dob=$_POST['dob'];
$feereceived=$_POST['feereceived'];
$due=$_POST['due'];
if(isset($_FILES['image']))
{
$image = addslashes(file_get_contents($_FILES['image']['tmp_name']));
}
$db = new mysqli("localhost", "root","","learndb");
if ($db->connect_error) {
die("Connection failed this is the error: " . $db->connect_error);
}
$stmt = $db->prepare("INSERT INTO studentrecords (Name, email, Phone, school,dob,father,feereceived,due,image) VALUES (?,?,?,?,?,?,?,?,?)");
if($stmt)
{
$stmt->bind_param("ssisssiib",$name,$email,$phone,$school,$dob,$father,$feereceived,$due,$image);
$stmt->execute();
echo"information entered.";
}