| | |
Not getting data in list box
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Nov 2008
Posts: 13
Reputation:
Solved Threads: 0
I want to fetch data from Mysql database in list box..but it's not happening
The code is:
The code is:
php Syntax (Toggle Plain Text)
<?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 } ?>
Last edited by peter_budo; Nov 24th, 2008 at 6:25 pm. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks) and [icode] (inline code) tags.
Your code should work. The only things I see missing are the
<select> tags to start and end the list box. html Syntax (Toggle Plain Text)
?><select><? while($row = mysql_fetch_array($result)) ...
~Jaseva
Here is a tutorial for building a select box from MySQL data.
Populating a Select Box With PHP and MySQL
I think Jaseva is right. You probably will not see the select box without the select tags. Use View, Source to take a look at the code being generated.
Populating a Select Box With PHP and MySQL
I think Jaseva is right. You probably will not see the select box without the select tags. Use View, Source to take a look at the code being generated.
Last edited by TopDogger; Nov 24th, 2008 at 8:51 am.
![]() |
Similar Threads
- getting data from a list box. (Visual Basic 4 / 5 / 6)
- Deleting A row from a List Box (Visual Basic 4 / 5 / 6)
- Data dissappears when moving from a List box (Visual Basic 4 / 5 / 6)
- Adding To a list box from multiple text boxes (Visual Basic 4 / 5 / 6)
- Multiline in a list box (Visual Basic 4 / 5 / 6)
- "Error in linking List box with the VB6.0 database" (Visual Basic 4 / 5 / 6)
Other Threads in the PHP Forum
- Previous Thread: hello guys I need help with this:<td> <? echo $row["referalvisits"]; ?>
- Next Thread: Encoding and saving password during login
Views: 738 | Replies: 2
| Thread Tools | Search this Thread |
Tag cloud for PHP
.htaccess access ajax apache api array beginner binary broken cakephp checkbox class cms code cron curl database date directory display download dynamic ebooks echo email error file files folder form forms function functions google href htaccess html image include insert integration ip java javascript joomla jquery js limit link login loop mail mediawiki menu methods mlm mod_rewrite multiple mysql oop parse paypal pdf php problem query radio random recursion regex remote script search select server sessions sms soap source space speed sql stored structure subdomain syntax system table tutorial update updates upload url validation validator variable video web xml youtube





