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条)

报告相同问题?

悬赏问题

  • ¥50 寻找一位有逆向游戏盾sdk 应用程序经验的技术
  • ¥15 请问有用MZmine处理 “Waters SYNAPT G2-Si QTOF质谱仪在MSE模式下采集的非靶向数据” 的分析教程吗
  • ¥50 opencv4nodejs 如何安装
  • ¥15 adb push异常 adb: error: 1409-byte write failed: Invalid argument
  • ¥15 nginx反向代理获取ip,java获取真实ip
  • ¥15 eda:门禁系统设计
  • ¥50 如何使用js去调用vscode-js-debugger的方法去调试网页
  • ¥15 376.1电表主站通信协议下发指令全被否认问题
  • ¥15 物体双站RCS和其组成阵列后的双站RCS关系验证
  • ¥15 复杂网络,变滞后传递熵,FDA