Jump to content

Recommended Posts

Need help with this code. I'm trying to delete images from a folder and table. I can delete the table infomation but i can't delete the image from the folder this is the code i'm using. Where am I going wrong.

 






mysql_connect("localhost", "", "")or die("cannot connect"); 
mysql_select_db("")or die("cannot select DB");

unlink('../loginarea/productimages' . $row['uploadfile']);

mysql_query("DELETE FROM hscatalogue WHERE ID = $_GET[id]") or die (mysql_error());

$result = mysql_query($sql);



echo "Your information has been DELETED!";





Link to comment
https://forums.phpfreaks.com/topic/242018-unlink-help/
Share on other sites

1. Make sure you have the right filename. Should there be a slash after "productimages"?

2. You may need to chmod 0777 the parent directory (loginarea). There might be a smarter solution so could you explain the hosting situation (who hosts the website, whether you have "shell"/SSH access or just FTP, and anything else you think might be relevant)?

Link to comment
https://forums.phpfreaks.com/topic/242018-unlink-help/#findComment-1242869
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.