Hi
i was wondering if anyone can help me with a small problem im having? i have this script that will let users delete there messages from my database witch is working great and with each message they save they have to upload a image it will save the path of the image in the database and save the image to a folder is there anyway when they delete a message it will also delete the image in the folder by grabbing the path from the selected message there trying to delete? i have tried using unlink($image); but have no idea how to go about adding this thanks...
my code:
PHP Code:
<?php
$checkbox = $_POST['checkbox'];
$delete = mysql_real_escape_string(strip_tags($_POST['delete']));
$user = mysql_real_escape_string($_SESSION['id']);
if($delete){
for($i=0;$i<$count;$i++){
$del_id = $checkbox[$i];
$sql = "UPDATE messages SET
WHERE id = '{$del_id}'
And username = '{$user}'";
mysql_query($sql, $conn)
or die('Error in query:<br>'. $sql .'<br>'.mysql_error($conn).'<br>Time of Error: '.date("l F j, Y, G:i:s T"));
}
if($result){
echo "<meta http-equiv=\"refresh\" content=\"0\">\n";
}
}
mysql_close();
?>