RE: [PHP-DB] Checkboxes to gather rows to delete
| From: | George Pitcher | Date: | Mon, 24 Feb 2003 15:57:54 +0000 |
| Subject: | RE: [PHP-DB] Checkboxes to gather rows to delete | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-25870@lists.php.net to get a copy of this message | ||
Hi all,
Can I raise a point of principle here.
My databases never have records deleted - instead they are marked as being
deleted in a status field. That way, they are always there for reference.
Unless you are running a system that needs the space or has extremely high
turnover of deleted records, this makes sesne.
Just my 2c.
George in Oxford
> -----Original Message-----
> From: Mathieu Dumoulin [mailto:mdumoulin@groupimage.com]
> Sent: 24 February 2003 3:49 pm
> To: php-db@lists.php.net
> Subject: Re: [PHP-DB] Checkboxes to gather rows to delete
>
>
> It is wrong to use that way of doing it John, cause this will delete ALL
> lines that where printed with a checkbox
> And also, if you are using a old version of PHP with register globals OFF,
> the _POST array will not be available
>
> Mathieu Dumoulin
>
> "1lt John W. Holmes" <holmes072000@charter.net> a écrit dans le message de
> news: 000b01c2dc1c$22449470$a629089b@TBHHCCDR...
> > > I have a mysql database with a table using one column as a
> primary key.
> > > (rowID). On a php page I use a query to list all of the rows of the
> table
> > > and have a checkbox beside each row that should be used to
> check if you
> > > would like to delete this row. Can someone give me an example
> using post
> > > to pull the boxes that need to be deleted.
> >
> > Easy one.. :)
> >
> > Make sure your checkboxes have the rowID as their value, then you can
> simply
> > do this:
> >
> > $query = "DELETE FROM table WHERE rowID IN (" .
> > implode(',',$_POST['checkboxes']) . ")";
> >
> > and run that query.
> >
> > You'll end up with something that looks like this:
> >
> > DELETE FROM table WHERE rowID IN (1,2,3,4,5)
> >
> > where the numbers will come from only the checkboxes that you selected.
> >
> > ---John Holmes...
> >
>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>