473,465 Members | 1,846 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Populating a list box from a MySQL Database and Creating a Query page

1 New Member
Hello all,
I am currently working on a project (a web based database) which entails the use of HTML, PHP and MySQL. I am new to all of these languages and would like some assistance in solving the following problem that I have encountered:
The project entails ADDing ,EDITing, DELETing records from a web based database. However the main objective of this project is to allow users to perform queries on the data in the database and then view the results. This is the point I have reached and would like to find out how to populate a list box using the contents from a MySQL table so that users can select multiple options from several list boxes. Any assistance (especially PHP code) in solving this problem will be greatly appreciated. Thanking you all in advance.

Regards,
Kurty
Mar 7 '07 #1
1 3191
ronverdonk
4,258 Recognized Expert Specialist
Welcome to TSDN.

If you really want us to help you out, you'll have to show the code you have made until now. So, show your code.

And show it within php or code tags, as required by the Posting Guidelines!!

As far as populating a select box with MySQL data is concerned, the following sample shows you one way of how to accomplish this.

[php]
echo '<select name="wgr" >';
echo '<option value="">Select group</option>'
$conn = mysql_connect(SQL_HOST, SQL_USER, SQL_PASS)
or die($msg_no_connect);
mysql_select_db(SQL_DB, $conn)
or die("Error connect: ".mysql_error());
$result=mysql_query("SELECT * FROM table_name")
or die("SELECT error: ".mysql_error());
while ($row=mysql_fetch_assoc($result)) {
$gr = $row['group'];
echo "<option value='$gr'>$gr</option>";
}[/php]

Ronald :cool:
Mar 8 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: mdh | last post by:
I am trying to learn the basics of MVC applications using a Tomcat infrastructure. I'm starting by building a simple application with: * a login.jsp page for a basic login form with a action...
0
by: Keith Bussey | last post by:
Hello all, After changing RAM and the ethernet card of my DB server, the problem of getting frequent: Database error (error code 102) Could not connect to database server (Lost connection to...
1
by: Cern | last post by:
Is it somebody out there who has made a migration from an Oracle server to an MySQL server?? The scenario is as simply: I've got a Oracle 8 server with a database with content that I want to...
1
by: cover | last post by:
Hi, Is there a site that anyone knows of, that shows creating a MySQL database from input through output is concerned? I'd LOVE to see a tutorial that included the interface for input, the usable...
10
by: Krakatioison | last post by:
Hi everyone, can someone point me to download of an example for saving and retrieving to/from MYSQL database. Or did anyone of you tried this and could share your code with me. I've got some data...
1
by: Accelerator | last post by:
Hi All I need to create a drop down list that is populated from a MySql database. I'm using ASP.net 1.1. If you have any related code, please post it here. Many thanks Accelerator
14
by: mistral | last post by:
Need php script to create mySQL database programmatically; since hosting configuration may not allow create database from script, script also need eliminate/rewrite all restrictions in appropriate...
8
by: menmysql | last post by:
i am not bale to solve this problem since two weeks i am trying to access records from mysql database using jsp. inside this jsp program i wrote all my JDBC code. it is working very nicely and...
8
by: malaysiauser | last post by:
Im new user of PHP and MySQL. I tried to use a script package for my web. I'd created a database. And my connection scripts are as follow; <?php $mysql_host="localhost"; ...
4
by: Gary Baardman | last post by:
I am having a few problems returning records from a mySQL database using PHP. Firstly I must say I am trying to create a video album using MySQL, PHP and using pagination. My first problem is...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.