View Single Post
Old 05-07-2009, 04:49 PM   #2 (permalink)
allworknoplay
The Gregarious
 
allworknoplay's Avatar
 
Join Date: Feb 2009
Location: New York
Posts: 645
Thanks: 64
allworknoplay is on a distinguished road
Default

I always like to use for loops, I always feel like I have better control over the data...here's what I would do...but I'm sure others could provide a simpler answer using WHILE...


PHP Code:
$result mysql_query ($query);
$count mysql_num_rows($result);
            
echo 
"<select name=cat_name value=' '>";
echo 
"<option value=''>View Available               Categories</option>";

for(
$i=0;$i<$count;$i++) {

$rows mysql_fetch_array($result);
$table_index $rows['table_index']; //whatever your index column is
$cat_name $rows['cat_name'];

if(
$i != 0) {
echo 
"<option value=\"$table_index\">$cat_name</option>";
}


allworknoplay is offline  
Reply With Quote