Hear us Roar
Article:
 |
|
Getting Started with PHP's HTML_QuickForm
|
| Subject: |
|
MySQL Table to PHP Array |
| Date: |
|
2006-02-12 13:06:35 |
| From: |
|
jgbutler
|
|
|
|
I'm sure there's a simple way to do this, but I'm such a newbie I can't figure it out...
I'm enjoying making my first HTML_QuickForm form, but I'm having trouble populating an array to use with $form->addElement('select'). I tried using the following code to pull data from a simple, 2-field MySQL table and insert it into an array named $genres, but all I get is the very first row of data. Can you clue me in as to how to get the other rows to cooperate?
Thanks!
mysql_select_db($database_tifrl, $tifrl);
$query_rsGenre = "SELECT * FROM genre";
$rsGenre = mysql_query($query_rsGenre) or die('Query failed: ' . mysql_error());
$ar_genre = mysql_fetch_array($rsGenre, MYSQL_ASSOC);
$genres = array ($ar_genre['genreID'] => $ar_genre['category']);
|
|
| |