Ok so i uploaded images with code below but i dont know how to display it, i want to make gallery so all i want is to display all images on one page, if you could explain that would be helpfull too!
<?php
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "phplogin";
$connect = mysqli_connect($servername,$username,$password,$dbname);
$file = $_FILES['image']['tmp_name'];
$ime = $_POST['ime'];
if(!isset($file))
{
echo "Izaberite sliku";
}
else
{
$image = addslashes(file_get_contents($_FILES['image']['tmp_name']));
$image_name = addslashes($_FILES['image']['name']);
$image_size = getimagesize($_FILES['image']['tmp_name']);
if($image_size == FALSE)
{
echo "Niste izabrali dobru sliku";
}
else
{
if(!$insert = mysqli_query($connect,"INSERT INTO store VALUES ('','$image_name','$image','$ime')"))
{
echo "Problem sa postavljanjem slike";
}
else
{
//$lastid = mysqli_insert_id($connect);
// I WANT TO DISPLAY IMAGES HERE
//echo "Image uploaded.<p />Slika:<p /><img src=get.php>";
}
}
}
?>
This code is to get image but it only display last ID and i dont know how to make it display all images
<?php
mysql_connect("localhost","root","") or die(mysql_error());
mysql_select_db("databaseimage") or die(mysql_error());
$id = addslashes($_REQUEST['id']);
$image = mysql_query("SELECT * FROM store WHERE id=$id");
$image = mysql_fetch_assoc($image);
$image = $image['image'];
header("Content-type: image/jpeg");
echo $image;
?>