please help me to display the multiple image from mysql
this id my file for uploading multiple image
$valid_formats = array("jpg", "jpeg", "png", "gif", "zip", "bmp", "pdf", "doc", "docx");
$max_file_size = 100000*100; //100 kb
$path = "uploads/"; // Upload directory
$count = 0;
extract($_REQUEST);
// Loop $_FILES to execute all files
foreach ($_FILES['files']['name'] as $f => $name) {
if ($_FILES['files']['error'][$f] == 4) {
continue; // Skip file if any error found
}
if ($_FILES['files']['error'][$f] == 0) {
if ($_FILES['files']['size'][$f] > $max_file_size) {
$message[] = "$name is too large!.";
continue; // Skip large files
}
elseif( ! in_array(pathinfo($name, PATHINFO_EXTENSION), $valid_formats) ){
$message[] = "$name is not a valid format";
continue; // Skip invalid file formats
}
else{ // No error found! Move uploaded files
if(move_uploaded_file($_FILES["files"]["tmp_name"][$f], $path.$name)) {
$query1=mysqli_query($conn,"INSERT INTO `nation`.`photoup` (`id`, `photos`) VALUES (NULL, '$path.$name')");
//$sq=mysqli_query($conn,"update uploads set photo='$path.$name' where id='$count'");
//set photo='$path.$name' where id='$count'");
if($query1==true)
{
echo "file uploaded";
}
echo $count;
$count++; // Number of successfully uploaded files
}
}
/* $result=mysqli_query($conn,"select photos from photoup");
$row=mysqli_fetch_array($result);
echo "<img src='".$row['photos']."'height='200px' width='300px'>"; */
}?>
<body>
<img src="getimage.php?id=<?php echo $id; ?>" width="175" height="200" />
<body>
<?php
}
?>
`
this ist the file for retrieving image from mysql..but am unable display image in the browser
<?php
include(confi.php);
// $id = $_GET['id'];
// do some validation here to ensure id is safe
$sql = mysqli_query($conn,"select photos from photoup where id=13");
$result = mysqli_query("$sql");
$row = mysqli_fetch_assoc($result);
header("Content-type: image/jpg");
header("Content-type: image/jpeg");
header("Content-type: image/png");
echo $row['photos'];
?>
Heading Here
`