dongzhang8475 2013-12-18 06:57
浏览 24
已采纳

注意:第16行的数组到字符串转换

Hope someone can help me out here, I'm quite new to php so keep that in mind. I'm having the above error in a php file which allows me to add new products to a database and I'm not sure where I went wrong when trying to upload the images. The product name, price, previous price and product details update ok, problem seems to be with adding images.

<?php

include('../connect.php');

$addid= $_POST['addrow'];

$addproduct= mysql_real_escape_string(htmlentities($_POST['addproduct']));
$addprice= mysql_real_escape_string(htmlentities($_POST['addprice']));
$addprevprice= mysql_real_escape_string(htmlentities($_POST['addprevprice']));
$adddetails= mysql_real_escape_string(htmlentities($_POST['adddetails']));
$addimage1= $_FILES['addimage1'];
$addimage2= $_FILES['addimage2'];
$addimage3= $_FILES['addimage3'];


    $query = "INSERT INTO admincamera (product, price, prevprice, details, image1, image2, image3)"."VALUES('$addproduct', '$addprice', '$addprevprice', '$adddetails', '$addimage1', '$addimage2', '$addimage3')";

mysql_query($query) or die(mysql_error());


mysql_close();

?>
  • 写回答

2条回答 默认 最新

  • doukongyong44772 2013-12-18 07:00
    关注

    You have to store image name in your database, because in image upload you receive array in $_FILES

    Uploaded image should be handled by you to store it on your server.

    $addimage1= mysql_real_escape_string($_FILES['addimage1']['name']);
    $addimage2= mysql_real_escape_string($_FILES['addimage2']['name']);
    $addimage3= mysql_real_escape_string($_FILES['addimage3']['name']);
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 使用ESP8266连接阿里云出现问题
  • ¥15 被蓝屏搞吐了,有偿求帮解答,Ai回复直接拉黑
  • ¥15 BP神经网络控制倒立摆
  • ¥20 要这个数学建模编程的代码 并且能完整允许出来结果 完整的过程和数据的结果
  • ¥15 html5+css和javascript有人可以帮吗?图片要怎么插入代码里面啊
  • ¥30 Unity接入微信SDK 无法开启摄像头
  • ¥20 有偿 写代码 要用特定的软件anaconda 里的jvpyter 用python3写
  • ¥20 cad图纸,chx-3六轴码垛机器人
  • ¥15 移动摄像头专网需要解vlan
  • ¥20 access多表提取相同字段数据并合并