Date: 06/20/02
- Next message: Glenn Holden: "Re: [PHP-DB] String datetime to DateTime"
- Previous message: Steve Bradwell: "[PHP-DB] Innodb and transactions."
- In reply to: Steve Bradwell: "[PHP-DB] Innodb and transactions."
- Next in thread: Jason Wong: "Re: [PHP-DB] Populating multi-select list from mysql"
- Reply: Jason Wong: "Re: [PHP-DB] Populating multi-select list from mysql"
- Maybe reply: Gary.Every <email protected>: "RE: [PHP-DB] Populating multi-select list from mysql"
- Maybe reply: Ryan Jameson (USA): "RE: [PHP-DB] Populating multi-select list from mysql"
- Maybe reply: Martin Clifford: "RE: [PHP-DB] Populating multi-select list from mysql"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hi all,
I'm having problems getting my multi-select list populated from a mysql
table. There is a table called categories with 2 columns (id and category).
I want to get all the items (category) and list them in the multi-select
list box.
This is the code I have so far:
$sql = "SELECT category FROM categories";
$result = mysql_query($sql, $connection);
while ($row = mysql_fetch_array($result)) {
$id = $row['id'];
$category = $row['category'];
$category_list .= "$category";
}
?>
<select name=category_list_array[] multiple size=10>
<?
for ($i=0; $i<count($category_list); $i++) {
?>
<option value=<?=$category_list[$i]?>><?=$category_list[$i]?></option>
<?}?>
</select>
Now, if I echo $category_list to the page I can see I have the correct data,
I just can't get it into the list box. I've seem to hit a wall on any
different ways to try and make this work. What am I doing wrong?
Thanks.
Rob.
-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
- Next message: Glenn Holden: "Re: [PHP-DB] String datetime to DateTime"
- Previous message: Steve Bradwell: "[PHP-DB] Innodb and transactions."
- In reply to: Steve Bradwell: "[PHP-DB] Innodb and transactions."
- Next in thread: Jason Wong: "Re: [PHP-DB] Populating multi-select list from mysql"
- Reply: Jason Wong: "Re: [PHP-DB] Populating multi-select list from mysql"
- Maybe reply: Gary.Every <email protected>: "RE: [PHP-DB] Populating multi-select list from mysql"
- Maybe reply: Ryan Jameson (USA): "RE: [PHP-DB] Populating multi-select list from mysql"
- Maybe reply: Martin Clifford: "RE: [PHP-DB] Populating multi-select list from mysql"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

