RE: [PHP] trying 2 pull data out table and populate a list box
| From: | Reinhart Viane | Date: | Fri, 29 Oct 2004 07:52:49 +0000 |
| Subject: | RE: [PHP] trying 2 pull data out table and populate a list box | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-200609@lists.php.net to get a copy of this message | ||
I always do this with a script like this:
$sql="select * from ladders order by laddername";
$rsladders=mysql_query($sql);
$aantal_ladders=mysql_num_rows($rsladders);
for($x=0;$x<$aantal_ladders;$x++)
{
$rijladders["$x"]=mysql_fetch_array($rsladders);
}
And then to populate the list:
<select name="ladder" id="select">
<?PHP
for($x=0;$x<$aantal_ladders;$x++)
{
echo('<option
value="'.$rijladders["$x"]["ladder_id"].'"');
echo('>'.$rijladders["$x"]["laddername"].'</option>');
}
?>
</select>
This works but I don't know if this is good coding
Greetz
Reinhart
-----Original Message-----
From: Garth Hapgood - Strickland [mailto:garth@redpoint.co.za]
Sent: donderdag 28 oktober 2004 17:19
To: php-general@lists.php.net
Subject: [PHP] trying 2 pull data out table and populate a list box
I am trying to pull all data out of a table called "province" which has
2 fields "ProvinceID" and "Description" respectively.
Now I want to populate a list with all the data in the "descriptions"
field.
Many thanx
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php