Unlink - Need help

Namecheap AuctionsNamecheap Auctions
Namecheap AuctionsNamecheap Auctions
SpaceshipSpaceship
Watch

bluemouse2

Established Member
Impact
10
Hi!
Can you please help me delete several files with unlink?
php Code:

PHP:
 $sql = "select filename from $aaa where owner='$id'";
   $result = mysql_query($sql) or die("Failed: $sql");
   $resrow = mysql_fetch_row($result);
 $filename = $resrow[0];
 @unlink("./files/".$filename);


this code deletes only one file.
there are several files to delete.

where do i go wrong? thanks.
 
0
Close
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
PHP:
 $sql = "select filename from $aaa where owner='$id'";
   $result = mysql_query($sql) or die("Failed: $sql");
  while ($row = mysql_fetch_array($result)) {
        @unlink("./files/".$row[0]);
}

Try this
 
Last edited:
1
Close
Thank you!
 
0
Close
no prob.
You can / should use mysql_fetch_row like you did in your code since your going to return an enumerated array
 
0
Close
The @ opertor is extremely slow. It'd be best if you checked if the result file existed, and then unlinked it.
 
0
Close
its not extermely slow ... it's slower.
 
0
Close
DomainEasy: flexible LTO options. Close more domain deals with financing.

We're social

Escrow.com
Spaceship
Domain Recover
CryptoExchange.com

NamePros updates

Switch between accounts
You can now stay logged in to more than one NamePros account in the same browser. Click your avatar, then "Accounts in this browser", to...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back