ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I have a question that i hope someone can help me with. Im running a debian server with Apache2 and Mysql.
I wonder if it is possible to delete stuff of a folder in my webserver if it is not in a certain collumn in a table in my mysql database?
for example, let's say that in /home/user/public_html/images/ i have an image called 4520As.jpg, is it possible to check this against a collumn called "name" in the table "images" in my mysql database and if the name of the image is not in that collumn of the database it will get deleted ?
Something similar to this should work. It's completely untested, hacked together from a couple of PHP scripts I had written for my work's website. I've set it up so it doesn't delete anything, only tells you which ones it would try to delete (for obvious reasons); if you want it to do actual deleting then uncomment the 'unlink()' command
Something similar to this should work. It's completely untested, hacked together from a couple of PHP scripts I had written for my work's website. I've set it up so it doesn't delete anything, only tells you which ones it would try to delete (for obvious reasons); if you want it to do actual deleting then uncomment the 'unlink()' command
Hope this helps,
Worked perfectly, thanks you very very much! is it possible to reverse his or add a line so that if there is a database entry for an image that do not exist the entry is removed from the database ?
It's pretty much the same as before - I've just swapped around the two arrays for keeping and listing images, and the code to delete items (so it deletes the database entry, not the file)
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.