PHP - MYSQL / Delete or unlink multiple files from folder?

Mittul Chuahan

New member
hello .. i have POLICIES table and COMPANIES table in my PHPMYADMIN and using PHP ..

now i have CREATE COMPANY.PHP and UPLOAD POLICY.PHP named webpages .

according to the page says .. in CREATE COMPANY the admin can create a new company by typing a name in textbox and in UPLOAD POLICY the user can upload new policies as per the company selection which we have created through CREATE COMPANY.,, i have used DROPDOWN and fetched the companies in it to select a company...

now what i want here is .. i have COMPANY_LISTING page in which all the company names will be shown at ROWS and the DELETE anchor link is there in the last TD..

if the admin clicks on it .. all the policies from the POLICIES table as per the COMPANY SELECTION will be deleted and in COMPANIES table the company name is also deleted ..

but here m stuck . as i want to delete these POLICIES from my FOLDER also which were uploaded in it ..

i mean i want to UNLINK (DELETE) these POLICIES from my UPLOADS folder also which were deleted from the database as per the company selection ..

how can i do it .. please help me ..

here is my sample code ..
--------------------------------------...
<?php
$qry1 = "delete from companies where id='" .$_GET['delid']."'";
$result1 = mysql_query($qry1) or die(mysql_error());
$qry2 = "delete from policy where id='" .$_GET['delid']."'";
$result2 = mysql_query($qry2) or die(mysql_error());
$qry3 = "delete from users where id='" .$_GET['delid']."'";

?>
--------------------------------------...

m showing just a simple query here how m successfully deleting the data from both COMPANIES and POLICIES tables .. but i want to UNLINK (DELETE) them from my FOLDER named "UPLOADS" also ..

i want to remove those files using ARRAY i think first to select and fetch them and then remove them from the FOLDER DIRECTORY called UPLOADS .. how to do this ..

please .. help me .. m stuck ..please help me ..
 
Back
Top