my task make dropdown list, using <option>
tag, out of table in database. simplify it, have created mysql procedure output value based on ranking in table. procedure has parameter id since output passed on <option>
tag. hence, each <option>
tag fetch single row outputted procedure based on id in database.
i know it's not ideal implementation, though, i'm working through can improve once basics working. current implementation, no data fetched database more after loop run once. here php code:
$counter=1; while ($exec2>0) { $res = mysql_query("call promostaff_ranking($counter);"); $exec3 = mysql_fetch_array($res); $fname = $exec3[0]; $lname = $exec3[1]; echo '<option value="';echo $fname; echo ' '; echo $lname;echo '" >';echo $fname; echo ' '; echo $lname; echo'</option>'; $exec2--; $counter++; }
in html, first dropdown option displays correctly, while second , third (since there should 3 options) blank. have outputted values of $counter , $exec2 second , third options, , have correct values able run procedure. however, guess after first iteration of loop, no value fetched $fname , $lname.
can enlighten me on this? love learn more , improve codes inputs. thanks!
Comments
Post a Comment