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

User feedback after MySQL query has been executed
Hi all, I've just registered on PHPFreaks because I've got a question that I simply can't work out b

Where do I put CRON code
So I've figured out alot about how to automatically run a php function. I can't figure out where to

upload image name with extension using php
hi frds..

<input id="file1" type="file" name="file[]" &a

newbie error
what is wrong with this code ?

<html>
<body>

<?

eregi to preg
Im converting my regex for php 5.3 and I am stuck on the following

Code: [Select]if((eregi(&q

dynamic table with forms
I have a table that is populated with mysql data and in teh first column there is a raido button tha

empty() error
Why does

Code: empty($USER_ID = $_SESSION["USER_ID"])
create this error...

try catch error
I have been trying try catch but, I can't get it to work. The code opens a non existing file called

How to know if online site made with PHP
Hello,
I see some sites that does not display extensions at all , for example:

www.site.co

WORDPRESS - Multiple Loops Only Going to One Post?
I have various pages with multiple loops and i need them to be individual to all other categories.

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