我无法将图像上传到我的数据库。我需要知道数据库中图像 table 的类型
I can't upload image to my database. I need to know the type of my image table in db
这是我的代码,一切正常,我的代码一切正常。所以我不知道数据库中的 image
table 应该是什么类型。
if(isset($_POST["title"]) && isset($_POST["content"]) && isset($_POST["order"])){
$title = $_POST["title"];
$content = $_POST["content"];
$order = $_POST["order"];
$image = $_FILES['image'] ;
$title = addslashes($title);
$content = addslashes($content);
$order = (float)$order;
$image = addslashes(file_get_contents($_FILES['image']['tmp_name'])) ;
$sql = "INSERT INTO items (name,description,`price`, `image`)
VALUES ('$title','$content','$order', '{$image}')" ;
mysqli_query($conn,$sql) or die('something wrong' . mysql_error());;
echo mysqli_error($conn);
}
有什么建议请帮忙,
谢谢
只需将图片放入文件夹,然后在数据库的列中插入图片的name/id,然后就可以像html一样用简单的代码调用它们,就像<img src="<?php $row['pathoftheimage'] /> ?>
">,
这是我的代码,一切正常,我的代码一切正常。所以我不知道数据库中的 image
table 应该是什么类型。
if(isset($_POST["title"]) && isset($_POST["content"]) && isset($_POST["order"])){
$title = $_POST["title"];
$content = $_POST["content"];
$order = $_POST["order"];
$image = $_FILES['image'] ;
$title = addslashes($title);
$content = addslashes($content);
$order = (float)$order;
$image = addslashes(file_get_contents($_FILES['image']['tmp_name'])) ;
$sql = "INSERT INTO items (name,description,`price`, `image`)
VALUES ('$title','$content','$order', '{$image}')" ;
mysqli_query($conn,$sql) or die('something wrong' . mysql_error());;
echo mysqli_error($conn);
}
有什么建议请帮忙, 谢谢
只需将图片放入文件夹,然后在数据库的列中插入图片的name/id,然后就可以像html一样用简单的代码调用它们,就像<img src="<?php $row['pathoftheimage'] /> ?>
">,