0

I want to fetch data from Mysql database in list box..but it's not happening
The code is:

<?php
  		include("connection.php");
  
  			$sql= "select student_age from student_data";
  			$result= mysql_query($sql);
			if(!$result)
			{
			die('could not connect:'.mysql_error());
			}
			
  
  		while($row = mysql_fetch_array($result))
 		 {
		 echo "anumita";
  	?>
     <option value="<?=$row[0]?>">
    	 <?=$row[0]?>
   		</option>
  	<?php
 	 }
 	 ?>
3
Contributors
2
Replies
3
Views
8 Years
Discussion Span
Last Post by TopDogger
0

Your code should work. The only things I see missing are the <select> tags to start and end the list box.

?><select><?
while($row = mysql_fetch_array($result))
...
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.