Re: Re: Need help for $unlink

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



You're going to need to loop through your results. I would personally  
also use mysql_query instead of mysql_fetch_object as well -- I seem  
to have an easier time navigating loops and such using that.
for ($i=0;$i<mysql_num_rows($query_result);$i++) {
    unlink('image_name.jpg');
}

If you're going to stick with mysql_fetch_object, you'll probably  
want to use a while loop.
while ($row = mysql_fetch_object($result)) {
   # unlink your file
}
--
Joe

On Jan 6, 2009, at 4:07 AM, arvindsri123 wrote:

> 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@xxxxxxxxxxxxxxx, "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
> >
>
>
> 



[Non-text portions of this message have been removed]


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Soap]     [Kernel Newbies]     [Yosemite]     [Yosemite Campsites]

  Powered by Linux