Re: Editing a Database
| From: | Chris Gray | Date: | Fri, 11 Aug 2000 09:34:20 +0000 |
| Subject: | Re: Editing a Database | ||
| References: | 1 2 3 4 5 6 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-6103@lists.php.net to get a copy of this message | ||
----- Original Message -----
Subject: Re: [PHP] Editing a Database
> Jeff Wilhelm wrote:
>
> > So basically I want the entire table listed (simple loop) and the
ability to
> > delete any row from the database. I have a pretty good idea of how to do
it,
> > but if someone could give me a little help it'd be great.
> >
> > Thanks!
> > -Jeff
>
Hi Jeff:
Try something like this ---
CASE " Delete ":
for ($n=1; $n<=$chk2size;$n++) {
if (isset($chk2[$n])) {
if ($chk2[$n] == 'checked')
$tID = $textID[$n];
$qid3 = db_query("DELETE FROM nEtext WHERE textID=$tID");
}
}
}
Where your HTML checkbox loop has
<input type="hidden" name="textID[<?=$n2?>]"
value="<?=$textID?>" >
<input type="checkbox" name="chk2[<?=$n2?>]"
value="checked">
after the loop
<input type="hidden" name="chk2size" value="<?=$n2?>">
Hope That Helps
Chris