selectbox+database connection retrive problem


Posted on 16th Feb 2014 07:03 pm by admin

Code: [Select]
<tr>
<th align="left" scope="col"><span class="style2 style8">Features </span></th>
<th colspan="2" align="left" scope="col"><span class="style8">
<textarea name="features" cols="30%" rows="6"></textarea>
</span></th>
<th scope="col"><span class="style8">
<select name="select">
<?php
$query="select ID, CODE from features order by ID asc";
$result=mysql_query($query);
while(list($id, $name)=mysql_fetch_row($result)) {
echo "<option value="".$id."">".$name."</option>";
}
?>
</select>
</span></th>
</tr>


hi frds...

am using same select box in 20 different place in same php page.for these i creating database connection,executing query and value display in select box.my question is ,i want write same set of code for 20 selectbox in my php page ?if it so means,my php form load very slowly because php is creating 20 different database conection on loading page.how to solve these problem??i need to creat one connection,using that one connection i should diaplay same values,20 select box in my php page any suggestion pls..

or

query="select ID, CODE from features order by ID asc";
$result=mysql_query($query);
can i store $result in any array variable.. then i can dispaly value in select box..?? suggest pls..thanks

No comments posted yet

Your Answer:

Login to answer
310 Like 18 Dislike
Previous forums Next forums
Other forums

Populate drop down list from table??
Lets say for arguments sake that i have a table which contains the numbers 1 to 10.
How can i get

Error with Font and imagettfbbox
I keep getting an error that says "Warning: imagettfbbox() [function.imagettfbbox]: Could not f

$_FILES array
Ok,

I just started experimenting with PHP today. My goal right now is to have people be able

Php - mysql select?
hi, i have this code:

Code: <?php
session_start();
// dBase file
include &quo

Echo-ing MySQL content and Keep Formatting?
I have data in my MySQL such as:

QuoteBlah blah

Blah blah

etc
but when i ech

extract content from a website
i have written a code that will grab the content from the index page..
i would like to know how c

Any Good MMORPGs you've played?
I'm about to have ALOT of free time on my hands (finished highschool) and I need something to fill t

unoconv doc convert to pdf code prob
PHP/5.3.1

Hi. I am trying to use this code to convert docs to .pdf utilizing unoconv. Howe

please, need help coding this voting for your favorite car polling system.
hi, my code needs a lot of work, but i want to be able to let users vote on their favorite car, upda

Contact Form Not Working When I Add Validation Codes
So I built my first working PHP "Contact Us" like form. But, I have been trying to now mak

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash