Re: Checkboxes to gather rows to delete

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thanks..... The below code returns each ID in an array like so...
Array ( [0] =>101 [1] => 201 ). Thanks for the help!
Lewis

$teacherID = $_POST[teacherID];
$deleteID = $_POST[deleteID];

if(isset($delete_teacher)) {
      This is where I should loop through checking for the chosen ones to
delete.....

    }

<form action="" method="POST">
 print "<input type=checkbox name=\"deleteID[]\"
value=\"$row[teacherID]\">";
 print "<input type=submit  name=\"delete_teacher\"  value=\"Delete the
Checked Teachers\">";


----- Original Message -----
From: "1LT John W. Holmes" <holmes072000@charter.net>
To: "Lewis Watson" <php@visionsix.com>; <php-db@lists.php.net>
Sent: Monday, February 24, 2003 10:21 AM
Subject: Re:  Checkboxes to gather rows to delete


> > Thats just it. I am just not sure what to do with the array before my
> > "delete from" query now that I have it :-)
> > Thanks...
> > Lewis
>
> You don't have to do anything with it, just throw it into the line that
I
> gave you. Show the code you have now and someone can help you put it all
> together.
>
> ---John Holmes...
>
> > ----- Original Message -----
> > From: "1LT John W. Holmes" <holmes072000@charter.net>
> > To: "Lewis Watson" <php@visionsix.com>; <php-db@lists.php.net>
> > Sent: Monday, February 24, 2003 10:13 AM
> > Subject: Re:  Checkboxes to gather rows to delete
> >
> >
> > > > I appreciate all of the quick replies. I do have globals off.
> > Currently, I
> > > > have the values for each ID being returned in a array.... Array
( [0]
> > =>
> > > > 101 [1] => 201 )  where 101 and 201 were the id's of the rows I
> > checked. I
> > > > have to say I like the way of doing it that Mathieu has shown
using
> > the
> > > > explode function.
> > > > Thanks again.
> > > > Lewis
> > >
> > > You already have an array of IDs you want to delete. Explode is for
> > making
> > > arrays, so what would you use it on? That doesn't make sense.
> > >
> > > $query = "DELETE FROM table WHERE rowID IN (" .
> > > implode(',',$_POST['id_array']) . ")";
> > >
> > > is the most efficient, easiest solution, but use whatever you
> > understand.
> > >
> > > ---John Holmes...
> > >
> >
> >
> > --
> > PHP Database Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux