George Botley Posted March 5, 2009 Share Posted March 5, 2009 Hello again guys.... I am having trouble with unlink to delete images now... Here is the full script <? $delete = $_GET["delete"]; $title = $_POST["title"]; if('yes' == $delete) { /* Check if user has actually chosen a value */ if(empty($title)) { echo "<div class='alerterror_info'> <strong>Please Choose A Category...</strong> - $fname, Please choose a category you would like to delete...</div>"; } /* If returned true remove photos and category */ else { $con = mysql_connect("$server","$dbuser","$dbpass"); $database = mysql_select_db("$database", $con); /* Delete Photos from Server */ $query_find = "SELECT * FROM ap_gallery WHERE category = '$title'"; $runquery_find = mysql_query($query_find); while($row = mysql_fetch_array($runquery_find)) { $photourl = $row["photourl"]; unlink("./userfiles/image/$photourl"); } /* $query = "DELETE FROM ap_gallery_cat WHERE title = '$title'"; mysql_query($query); $querytwo = "DELETE FROM ap_gallery WHERE category = '$title'"; mysql_query($runquery); echo "<meta http-equiv='refresh' content='0;url=index.php?ToDo=WebsiteContent/Gallery&error=no3' />"; */ } } ?> Some functions are commented to disable the run whilst I get the unlink inorder. Any ideas? Link to comment https://forums.phpfreaks.com/topic/148069-unlink-error/ Share on other sites More sharing options...
George Botley Posted March 5, 2009 Author Share Posted March 5, 2009 Anyone know? Link to comment https://forums.phpfreaks.com/topic/148069-unlink-error/#findComment-777201 Share on other sites More sharing options...
alphanumetrix Posted March 5, 2009 Share Posted March 5, 2009 personally, i didn't know you could use unlink on images (never bothered trying it - makes sense though). try this: unlink("userfiles/image/".$photourl); I think you just wrote the string wrong. If that doesn't work, you might want to try this, too: unlink("userfiles/image".$photourl); You might not need the tailing slash, as your url already has it, or the server puts it in automatically in a string. Link to comment https://forums.phpfreaks.com/topic/148069-unlink-error/#findComment-777236 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.