> I have a database (mysql) that has some rows entered.
>
> Format:
> Name | Desription | catid
>
> This has some info in it like this
>
> Joe Man 1
> Jack Man 1
> Jacky Female 2
> Emily Female 2
>
> What I am trying to do is create dynamically created select lists so
> that all with catid 1 are in the fisrt select list and all with catid 2
> are in a separate second list and so on.
>
> I have it nearly working but the first list gives the cadid 1 result the
> second gives catid 1 and catid 2 result and so on.
>
> So how would I split the results?

<?
$result = mysql_query("SELECT * FROM table");
while($row = mysql_fetch_assoc($result))
{ $option[$row['catid']] = "<option
value='{$row['Name']}'>{$row['Name']}</option>\n"; }

Then use $option[1] and $option[2] in your different select boxes.

<select name="male">
<?=$option[1]?>
</select>

---John Holmes...


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

Reply via email to