如何在Php中将多个图像存储在数据库中 [英] How To I Store Multiple Images In Database In Php
本文介绍了如何在Php中将多个图像存储在数据库中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我希望使用php在一列中将多个图像存储在数据库中。我试过这段代码
在这里输入代码
< html>
< head>
< title> ;商店详细信息注册表中的更多选项< / title>
< / head>
< body>
< form action =method =postenctype =multipart / form-data>
I want o store multiple images in database in one column using php. i tried this code
enter code here
<html>
<head>
<title>more option in shop detail register form </title>
</head>
<body>
<form action="" method="post" enctype="multipart/form-data">
Image1 | < input type =filename =image > |
Image2 | < input type =filename =image> |
Image3 | < input type =filename =image> |
购物 | < input type =textname =shop> |
商店详情 | < input type =textname =shopdetails> |
电话 | < inpu t type =textname =phone> |
可用在 | < input type =textname =availableon> |
< input type =submitname =submitvalue =Submit> |
Image1 | <input type="file" name="image"> |
Image2 | <input type="file" name="image"> |
Image3 | <input type="file" name="image"> |
Shop | <input type="text" name="shop"> |
Shop Details | <input type="text" name="shopdetails"> |
Phone | <input type="text" name="phone"> |
Available On | <input type="text" name="availableon"> |
<input type="submit" name="submit" value="Submit"> |
</form>
</body>
</html>`enter code here`$msg="";
if(isset($_POST['submit']))
{
$filename =$_FILES['image']['name'];
$temppath =$_FILES['image']['tmp_name'];
$move =move_uploaded_file($temppath,'upload/'.$filename);
$shop=$_POST['shop'];
$shopdetails=$_POST['shopdetails'];
$phone=$_POST['phone'];
$availableon=$_POST['availableon'];
$query="insert into details(image,shop,shopdetails,phone,availableon)values('$filename','$shop','$shopdetails','$phone','$availableon')";
$sql=mysql_query($query);
if($sql)
{
$msg.="Thank you for registering here";
}
else
{
$msg.="try again";
}
}
推荐答案
msg =;
if(isset(
msg="";
if(isset(
_POST ['submit']))
{
_POST['submit']))
{
filename =
filename =
这篇关于如何在Php中将多个图像存储在数据库中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取
|
15天全站免登陆