Entry Table
|
|
Genoa Table Collection … |
longest rally at 2008 semi final table tennis albert hall
Using Php to Populate a Drop Down List Box From a Mysql Database Table
Quite often when you are developing web sites or applications it is necessary to create a drop down list box that contains entries from a database table. You can, of course, hard code the items in the drop down list box, but this isn’t really very elegant, and can create problems if the entries in the database table change at a later date. It is much better to extract the entries from the database table directly and then populate the drop down list box using those entries.
Creating the database table
The following script, database-table.sql, could typically be used to create a database table (called ‘years’) that contains, for example, a list of years. These will be the entries that appear in the drop down list box.
database-table.sql
create table years
( yearID integer auto_increment,
year varchar(30),
primary key (yearID)
);
insert into years (yearID, year) values (’1′, ‘2007-2008′);
insert into years (yearID, year) values (’2′, ‘2008-2009′);
insert into years (yearID, year) values (’3′, ‘2009-2010′);
insert into years (yearID, year) values (’4′, ‘2010-2011′);
insert into years (yearID, year) values (’5′, ‘2011-2012′);
insert into years (yearID, year) values (’6′, ‘2012-2013′);
The following PHP script (populate-list.php), which would form part of a form, will extract all the entries from the ‘years’ database table, and use them to populate the drop down list box.
populate-list.php
If the entries in the database table change at some stage in the future, those changes will be automatically reflected in the drop down list box in the form.
About the Author
John Dixon is a web developer working through his own company John Dixon Technology. In addition to providing web development services, John’s company also provides a free accounting tool called Earnings Tracker, as well as other free software downloads, various tutorials, articles, a business and finance blog and several news feeds.
|
|
Genoa Table Collection … |
|
|
Concord Table Collection … |
|
|
Winsome Wood Hall Table, Espresso $69.39 This stylish console table is an ideal accent piece for any room.Its long, flat surface is perfect for displaying photos or as a complement to an overcrowded desk…. |
|
|
Imperial Fanfares $5.64 … |
|
|
Asian Styled Console Table Lamp with Fabric Shade $145.00 Definitely evoking an Asian sensibility of calm and order, this accent lamp is as much a piece of art as it is a lamp…. |
|
|
Tall & Slender Asian Styled Etched Brown Glass Console Table Lamp $195.00 Tall, slender, and with a distinctly organic feel, this etched glass cylinder of dark brown glass has an Asian sensibility of calm, and is a good choice for a console in a contemporary room with high ceilings…. |
|
|
Nautilus Shell Console Table Lamp $120.00 A good choice for a beach house or room with a seaside feel, this resin nautilus shell lamp is tall enough for end table, bedside or console…. |
|
|
Grand Estates Console Table – Classic Brown $259.99 “Grand Estates” is a superb collection of home furnishings designed to bring your home to a new level of sophistication, at an incredible value! Constructed of hardwood with hardwood veneers, this elegant furniture collection features classic lines with a fabulous hand-painted effect that creates the look and feel of real leather, complemented by highly-stylized design. The result is a graceful fu… |
|
|
Linear 2-Tier End Table – Slate $199.99 Based on a classic design, the Linear tier end table is true form and function and truly good for the planet. Constructed from just five pieces of Forest Stewardship Council (FSC) Certified/environmentally friendly SmartWood, this table assembles in minutes with InModern’s patented, no-tools assembly method. Top shelf holds your favorite lamp or decorative items while the bottom shelf allows for b… |
|
|
Linear 2-Tier End Table – Cocoa $199.99 Based on a classic design, the Linear tier end table is true form and function and truly good for the planet. Constructed from just five pieces of Forest Stewardship Council (FSC) Certified/environmentally friendly SmartWood, this table assembles in minutes with InModern’s patented, no-tools assembly method. Top shelf holds your favorite lamp or decorative items while the bottom shelf allows for b… |
Tags: css, entry table and mirror, entry table and mirror set, entry table ideas, entry table with storage, entry tables, html, table, tips, webdesign