akaballa123
Technical User
hi im a phph newb and have a problem with my code.
I have created a code to retrieve information from a field in a mysql database. I am displaying the information in a drop down field through running a while loop:
<?php
$result = @mysql_query('SELECT trainingName FROM addtrainingTbl');
while($score=mysql_fetch_array($result))
{
//Array or records stored in $score
echo "<option value='first'>$score[trainingName]</option>";
/* Option values are added by looping through the array */
}
echo "</select>";// Closing of list box
?>
When I load my form page, my drop down list is blank. However, when I run an echo statement to check if the field info is being displayed, the information displays on my screen. So I know that the database connection is correct.
Is there a syntax error, or is there something wrong with my code?
Thanks
I have created a code to retrieve information from a field in a mysql database. I am displaying the information in a drop down field through running a while loop:
<?php
$result = @mysql_query('SELECT trainingName FROM addtrainingTbl');
while($score=mysql_fetch_array($result))
{
//Array or records stored in $score
echo "<option value='first'>$score[trainingName]</option>";
/* Option values are added by looping through the array */
}
echo "</select>";// Closing of list box
?>
When I load my form page, my drop down list is blank. However, when I run an echo statement to check if the field info is being displayed, the information displays on my screen. So I know that the database connection is correct.
Is there a syntax error, or is there something wrong with my code?
Thanks