I have image upload system on my website that uploads the users images with text and displays it on the screen. On the profiles page is shows what they uploaded and works perfectly fine. When I try to display those images on another page the images don't show. They literally only show on the profiles page.The images wont display on any other page.
I've tried selecting it the same way I did in the profiles page and it still doesn't show the image. I've also tried putting it in an array and echoing it out with a foreach loop, but it still only shows the text. I also tried just displaying it as an img instead of a div with a background image.
$sql2 = "SELECT * FROM gallery ORDER BY orderGallery DESC";
$stmt2 = mysqli_stmt_init($conn);
if (!mysqli_stmt_prepare($stmt2, $sql2)){
echo "SQL statement failed!";
}else{
mysqli_stmt_execute($stmt2);
$result2 = mysqli_stmt_get_result($stmt2);
while ($row2 = mysqli_fetch_assoc($result2)){
echo '<a href="#">
<div style="background-image: url(Pics/gallery/'.$row2["imgFullNameGallery"].');"></div>
<h3 >'.$row2["titleGallery"].'</h3>
<p>'.$row2["descGallery"].'</p>
<link rel="stylesheet" type="text/css" href="Profile.css">
</a>';
}
}
//This is the one that works in profiles.php.
$sql2 = "SELECT * FROM gallery WHERE idUser = '$current' ORDER BY orderGallery DESC";
$stmt2 = mysqli_stmt_init($conn);
if (!mysqli_stmt_prepare($stmt2, $sql2)){
echo "SQL statement failed!";
}else{
mysqli_stmt_execute($stmt2);
$result2 = mysqli_stmt_get_result($stmt2);
while ($row2 = mysqli_fetch_assoc($result2)){
echo '<a href="#">
<div style="background-image: url(Pics/gallery/'.$row2["imgFullNameGallery"].');"></div>
<h3 >'.$row2["titleGallery"].'</h3>
<p>'.$row2["descGallery"].'</p>
I expect the output to be the image and the text, but the actual output is just the text. I'm so confused and seriously stumped.