Answer the question
In order to leave comments, you need to log in
Why are the pictures not showing up in the folder?
Pictures are stored in the upload folder. If I display the names of the pictures, then everything works; if I try to display the images, it displays a square of white lines on a
black screen. Pictures in jpeg format database.
<?php
Header('Content-Type: image/jpg');
$category=$_GET[category];
$host = 'localhost'; // адрес сервера
$database = 'imagess'; // имя базы данных
$user = 'admin'; // имя пользователя
$password = '12345'; // пароль
$link = mysqli_connect($host, $user, $password, $database)
or die("Ошибка " . mysqli_error($link));
$res = mysqli_query($link,"SELECT name FROM imagess WHERE category='".$category."'");
while($row = mysqli_fetch_array($res)) {
$src='upload/'.$row['name'];
?>
<img src="<?php echo $src; ?>"/>
<?php
}
mysql_close($conn);
?>
$src='upload/'.$res['name'];
Answer the question
In order to leave comments, you need to log in
1. Have you checked the folder permissions?
2. The URL you get is "upload/...", that is, relative to the current URL of the page with pictures.
That is, if this page is "www.example.com/gallery", then the pictures will be "www.example.com/gallery/upload/...".
Add a slash $src = "/upload/...". Then the image source will be "www.example.com/upload/...".
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question