My next dillema, I am trying to add a checkbox next to each picture and a button that will delete the selected picture files and sql. (already have a function for that)
Code that displays the thumbs
<?php
$images = glob('photos/thumbs/*.jpg');
$images2 = glob('photos/thumbs/*.JPG');
foreach($images as $image)
{
$src = 'photos/thumbs/'.basename($image);
echo "<img src='$src'>";
}
foreach($images2 as $image2)
{
$src = 'photos/thumbs/'.basename($image2);
echo "<img src='$src'>";
}
?>
</body>
</html>
Delete photo function:
function delete_photo($photo_id)
{
$result = mysql_query("
SELECT photo_filename
FROM gallery_photo
WHERE photo_id = '" . addslashes($photo_id) . "'
");
list($filename) = mysql_fetch_array($result);
mysql_free_result($result);
unlink($images_dir . '/' . $filename);
mysql_query("
DELETE FROM gallery_photo
WHERE photo_id='" . addslashes($photo_id) . "'
");
}
I guess I can call the function to delete the picture by:
delete_photo(PHOTO_ID);
I tried to add the html for the checkbox after the line that echos the <src> but I wasn't getting it, probably due to syntax error.
Thanks