dennismonsewicz Posted April 11, 2008 Share Posted April 11, 2008 Code: $query2 = mysql_query("SELECT * FROM uploads where id = " . $id . ""); $row = mysql_fetch_array($query2); $filename = $row['name']; $imgdir = "imageuploads/"; unlink($imgdir . $filename); For some reason the above code does not work. Any ideas? Quote Link to comment Share on other sites More sharing options...
GingerRobot Posted April 11, 2008 Share Posted April 11, 2008 For starters, add error checking on the query: <?php $sql = "SELECT * FROM uploads where id = $id"; $result = mysql_query() or die(mysql_error().'<br />On the query:'.$sql); if(mysql_num_rows($result) == 1){ $row = mysql_fetch_assoc($result); $filename = $row['name']; $imgdir = "imageuploads/"; unlink($imgdir . $filename); }else{ echo 'ID does not exist!'; } ?> Quote Link to comment Share on other sites More sharing options...
dennismonsewicz Posted April 11, 2008 Author Share Posted April 11, 2008 ok did that and still it is not deleting it out of the dir Quote Link to comment Share on other sites More sharing options...
dennismonsewicz Posted April 11, 2008 Author Share Posted April 11, 2008 I fixed the problem Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.