jeudi 2 avril 2015

How to while loop images from directory

Surprisingly, Google had nothing.


My old method of uploading images was storing the actual image in the database. I'm trying to change my method to storing the photos in directories. But I'm having troubles figuring out how to display them to the users. I'm trying to while loop the files. Much help is greatly appreciated. Also, PDO is not my strong suit, trying to learn it the best I can. Here is what I have.



$query6 = "SELECT * FROM photos WHERE userID=$memberID";
$result6 = $db->query($query6);

while ($row6 = $result6->fetch(PDO::FETCH_ASSOC)) {

$photo = $row6['photo'];

while ($photo == true) {

echo "<img src=\"images/$memberID/$photo\">";

}

}


The page isn't loading at all. Not even an error. Your help is greatly appreciated. Thank You!


The code does insert the photo name in database and properly upload the photo to the directories. I only need assistance with displaying to the user. :)


Aucun commentaire:

Enregistrer un commentaire