注意:第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();

?>

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']);

This is because $addimage1 expects a string value. However, $_FILES['addimage1'] is an array (Read more at: http://www.php.net/manual/en/reserved.variables.files.php). Thus it threw the error.

If you would like to store its file name, you should be doing like what @Parixit suggested.