on 3/30/02 6:33 PM, wesley grubbs:. at [EMAIL PROTECTED] appended the
following bits to my mbox:
> foreach($_POST["del"] as $val) {
>
> $sql = "DELETE FROM $tablename WHERE id = $val";
Be very careful with this. If a user spoofs the form and adds the value for
del like this:
Would make the
You can go one better than this, even...
use PHP to construct a single SQL query
using the IN( ) comparator, ie:
"Olinux" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> to make it a little better, make one connection to the
> db before you loop and then clo
to make it a little better, make one connection to the
db before you loop and then close the connection
[connect]
foreach loop
[close connect]
olinux
--- "wesley grubbs:." <[EMAIL PROTECTED]> wrote:
> thanks guys for the aid.
>
> in the end, i went with creating a check box that
> looks like t
thanks guys for the aid.
in the end, i went with creating a check box that looks like this:
and the dirty work of deleting it looks like this::
foreach($_POST["del"] as $val) {
$sql = "DELETE FROM $tablename WHERE id = $val";
...connect to database.. run $sql.. close db.. yadda yadda..
}
;[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, March 30, 2002 4:58 AM
Subject: [PHP-DB] using multiple checkboxes to delete from db
> i've been playing half the day with trying to get php to delete rows when
a
> checkbox is checked.
>
> i have a page that p
Or something of that sort. Hope it helps.
-Mike
[EMAIL PROTECTED]
http://www.soreye.com
- Original Message -
From: "wesley grubbs:." <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, March 30, 2002 4:58 AM
Subject: [PHP-DB] using multiple chec
i've been playing half the day with trying to get php to delete rows when a
checkbox is checked.
i have a page that pulls all the data from db in a table. one row contains
checkboxes. i want it so that whereever a checkbox is checked and then
submit, all the selected rows will be deleted.