On Fri, Mar 6, 2009 at 4:00 PM, PJ <af.gour...@videotron.ca> wrote:

> I've been racking my little peanut-brain as well as big Google with
> little hope...
> I can retrieve the array from the multiple select dropdown box but I
> can't quite manage to insert the data which is just id numbers for a table.
> I've tried some while stuff but doesn't work. I know I don't have the
> right syntax on anything at this point. Here's an effort that doesn' work.
> Dont know if I should be using $categoriesIN[] type of stuff...
> but my tries were from web illustrations...
> the outcommented line returns the values of the array... but how to pass
> them to the query?
>
> foreach ($categoriesIN as $category) {
>    //"$category<br>";
> $sql = "INSERT INTO book_categories ( book_id, category )
>    VALUES( book.id WHERE title = $titleIN, $category )";
>        $result = mysql_query($query, $db);;
>    }
> TIA
>
> --
> unheralded genius: "A clean desk is the sign of a dull mind. "
> -------------------------------------------------------------
> Phil Jourdan --- p...@ptahhotep.com
>   http://www.ptahhotep.com
>   http://www.chiccantine.com/andypantry.php
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
As its an array, you could join the data with an IMPLODE into a string, but
does that meet your needs? The other option is to create a sub-table for
this element and insert each item thru a loop individually.

-- 

Bastien

Cat, the other other white meat

Reply via email to