Hi Arvind, I think that you are using 10 images per row of your table. so, you want to delete all the images when you delete that particular row. If i am right then see the code below: $sql = "SELECT image_1, image_2,..., image_10 FROM image_table WHERE id='".$id."' LIMIT 1"; $result = mysql_query($sql); $nrow = mysql_affected_rows(); if ($nrow == 1) { $row = mysql_fetch_array($result); for($i=1; $i <= 10; $i++) { if (file_exists('images/'.$row['image_'.$i])) { unlink('images/'.$row['image_'.$i]); } } } I hope that it will be useful to you. Thanks & Regards Udayakumar Sarangapani Sr. PHP Developer CompIndia Infotech Pvt. Ltd. Chennai. "Science is nothing but logic..." ________________________________ From: arvindsri123 <arvindsri123@xxxxxxxxx> To: php-objects@xxxxxxxxxxxxxxx Sent: Tuesday, 6 January, 2009 3:37:43 PM Subject: Re: Need help for $unlink Hello, Actually I have 10 columns like Image_1, Image_1, Image_1...Image_ 10. when i am trying to unlink its deleting only one iamge at a time, i want to delete all images from all columns, may send ur script again based on my requirement. Thanks, AAvi --- In php-objects@ yahoogroups. com, "avishek_mca84" <avishek_mca84@ ...> wrote: > > > Hi Rajesh > > i think u r using wrong code for deleting the image > > u should uuse this code for deleteting the image and the record from > data base > > > > <?php > $m_id = $_REQUEST['m_ id']; > $query = "select * FROM model_photos WHERE m_id='$m_id' "; > $image_obj=mysql_ fetch_object( $query); > unlink("uploads/ $image_obj- >image"); > > $query1 = "DELETE FROM model_photos WHERE m_id='$m_id' "; > $result1 = mysql_query( $query1) or die('Query failed: ' . > mysql_error( )); > > > > > i think this will help u better. > thanks > Avishek Kumar(9748141833) > Web Developer > Nettrackers > Kolkata > Connect with friends all over the world. Get Yahoo! India Messenger at http://in.messenger.yahoo.com/?wm=n/ [Non-text portions of this message have been removed]