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 this:
>
> <input type="checkbox" name="del[]" value="<?php
> print($row[id]); ?>">
>
> 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 can do this on the same page... it's short and
> pretty easy to follow. ...
> oh .. and it works :)
>
> wes
>
>
> > 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 for
> > loop doing the delete statement for each id. Like
> the following code.
> >
> > for($i = 0; $i < count(chkBoxArray); $i++){
> > $sql = "DELETE FROM tblName WHERE tblID =
> '$row[$i]'";
> > if(!sql_query($sql)){
> > echo "ERROR: ".mysql_query();
> > }
> > }
> >
> > Or something of that sort. Hope it helps.
> >
> > -Mike
> > [EMAIL PROTECTED]
> > http://www.soreye.com
>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
__________________________________________________
Do You Yahoo!?
Yahoo! Greetings - send holiday greetings for Easter, Passover
http://greetings.yahoo.com/
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php