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..
}
I believe what you want to do is create an array with the id and delete as
separate values.
Here's an example using an array of studentdata containing variables
send_mail, this_studentname, this_paid.
The rows of students are output like this:
In this case all o
One way you could do this. Is have the form point to itself i.e. $PHP_SELF,
then set a variable in the form if it is set when the page loads the run the
form processing script. As for the delete function one way to do it would
be since you are holding the checkboxes in an array. Do a while or a