haris244808 Posted September 17, 2012 Share Posted September 17, 2012 im trying to delete 2 files but the unlink function doesnt delete them any suggestion here is function im using: public function place_delete(){ $cityPlace_UploadDir = $this->cityPlace_Dir . $this->place_main_photo_name; $cityPlace_UploadThumbDir = $this->cityPlace_thumbsDir . $this->place_main_photo_name; if(unlink($cityPlace_UploadDir)){ if(unlink($cityPlace_UploadThumbDir)){ //DELETE some sql values return (mysql_affected_rows() == 1) ? true : false; } else{ return false; } } else{ return false; } } Quote Link to comment https://forums.phpfreaks.com/topic/268453-unlink-problem/ Share on other sites More sharing options...
requinix Posted September 17, 2012 Share Posted September 17, 2012 Have you done any debugging yet? Printed out values and made sure they're right? Made sure your php.ini has error_reporting = -1 display_errors = on and looked for error messages? Quote Link to comment https://forums.phpfreaks.com/topic/268453-unlink-problem/#findComment-1378520 Share on other sites More sharing options...
Christian F. Posted September 17, 2012 Share Posted September 17, 2012 Also, please use the tags around your code, as it helps make both your post and your code a lot easier to read. Quote Link to comment https://forums.phpfreaks.com/topic/268453-unlink-problem/#findComment-1378542 Share on other sites More sharing options...
jazzman1 Posted September 17, 2012 Share Posted September 17, 2012 In addition to @requinix, Do you know that you need to call this function somewhere in your script? Quote Link to comment https://forums.phpfreaks.com/topic/268453-unlink-problem/#findComment-1378563 Share on other sites More sharing options...
haris244808 Posted September 17, 2012 Author Share Posted September 17, 2012 Have you done any debugging yet? Printed out values and made sure they're right? Made sure your php.ini has error_reporting = -1 display_errors = on and looked for error messages? here are the configs in php.ini: i debuged and it shows no error. I am using classess. I get a file name and directory to another function and assign them to those values inside unlink() function error_reporting = E_ALL | E_STRICT ; error_reporting ; Default Value: E_ALL & ~E_NOTICE ; Development Value: E_ALL | E_STRICT ; Production Value: E_ALL & ~E_DEPRECATED ; display_errors ; Default Value: On ; Development Value: On ; Production Value: Off Quote Link to comment https://forums.phpfreaks.com/topic/268453-unlink-problem/#findComment-1378564 Share on other sites More sharing options...
haris244808 Posted September 17, 2012 Author Share Posted September 17, 2012 Also, please use the tags around your code, as it helps make both your post and your code a lot easier to read. i cannot edit now... Im Sorry for that mistake Quote Link to comment https://forums.phpfreaks.com/topic/268453-unlink-problem/#findComment-1378565 Share on other sites More sharing options...
haris244808 Posted September 17, 2012 Author Share Posted September 17, 2012 In addition to @requinix, Do you know that you need to call this function somewhere in your script? of course that i call that function to another page Quote Link to comment https://forums.phpfreaks.com/topic/268453-unlink-problem/#findComment-1378567 Share on other sites More sharing options...
haris244808 Posted September 17, 2012 Author Share Posted September 17, 2012 i figured it out... it was not getting the filename corrrectly thnx anyway Quote Link to comment https://forums.phpfreaks.com/topic/268453-unlink-problem/#findComment-1378582 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.