WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDES  |  PHP CLASSES  |  CODE SEARCH  |  ARTICLES SEARCH  |  PHP FORUMS  |  PHP MANUAL  |  PHP FUNCTIONS LIST  |  WEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search
Submit a code Example / Snippet Submit Your Code
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
WeberDev's Monthly code contest PHP Code Contest
Your Personal Examples List My Favorite Examples
Your Personal Articles List My Favorite Articles
Edit Account Info Update Your Profile
PHP Code Search
Web Development Forums
Learn MySQL Playing Trivia
PHPBB2 Templates
Web Development Index
Web Development Resources
Web Development Content
PHPClasses
PHP Editor
PHP Jobs
Vision.To Design
Ajax Tutorials
PHP Programming Help
PHP/MySQL Programming
Webmaster Resources
Webmaster Forum
XML meta language
website builder
Mobile Dev World

Go Back Add a Comment Send this example to a friend Add this Article to your personal favoritest for easy future access to your favorite Code Examples and Articles. Submit a code example Print this code example.
BACK ADD A COMMENT SEND TO A FRIEND ADD TO MY FAVORITES ADD CODE EXAMPLES PRINT
Title : Dynamically generated pop-ups (Select items)
Categories : PHP, HTML and PHP, MySQL, Databases Update Picture
Jax Robertson
Date : Aug 17th 1998
Grade : 1 of 5 (graded 2 times)
Viewed : 20955
File : No file for this code example.
Images : No Images for this code example.
Search : More code by Jax Robertson
Action : Grade This Code Example
Tools : My Examples List

Submit your own code examples 
 

This code snippet will allow you to generate pop-up items by querying the
specific table in a database. This is particularly useful if you have data
that grows (for example, if your clients can add information to your tables,
like states they ship to, or job categories, etc.) This way, your .php3
files or HTML won't have to be updated.

<?php
//.
//.
//.
function show_options($db, $tableName)
{
$result = db_query ($db, "SELECT * FROM $tableName");
while (list($id, $name) = db_fetch_row($result))
{
echo "<option value=$id>$name</option>\n";
}
}
//.
//.
//.
?>

<body>
<select name="State">
<?php show_options($dbid, "TABLENAME"); ?>
</select>
</body>



Functions for loading images into a MySQL database and displaying them.
Categories : Graphics, HTML and PHP, MySQL, PHP, Databases
dynamic table columns
Categories : PHP, HTML and PHP, Arrays, Databases, MySQL
Pull Down Surfing - Surf on Change
Categories : Java Script, MySQL, HTML and PHP, PHP, Databases
Complex paging with no resultset limit
Categories : PHP, MySQL, Databases, Output Control, HTML and PHP
phpFormGenerator for Dynamic Form Generation from MySQL
Categories : PHP, PHP Classes, MySQL, Databases, HTML and PHP
Message of the Day - Random Message (Needs MySQL!)
Categories : Databases, HTML and PHP, PHP, MySQL
Required form fields that pull from MySQL database
Categories : PHP, HTML and PHP, Databases, MySQL
mySQL/PHP/search with multientry form and table output with colored rows
Categories : PHP, Beginner Guides, MySQL, HTML and PHP, Databases
Creating thumbnails from MySQL Blobs online
Categories : PHP, MySQL, Graphics, HTML and PHP, Databases
Record Set Paging with PHP (RSP)
Categories : PHP, MySQL, Navigation, Databases, HTML and PHP
Alternating background color for HTML table rows
Categories : PHP, Databases, MySQL, HTML and PHP
Database resultset navigation
Categories : PHP, HTML and PHP, Databases, MySQL, Navigation
Function to do live population of HTML's <Select> tag from a Table
Categories : PHP, MySQL, HTML and PHP, Databases
Storing / Retrieving pictures from database This can be used for banner / ads exchange. very useful for people developing big portal with ads in the site........
Categories : PHP, MySQL, Databases, HTML and PHP
Editing the virtusertable and sendmail.cw via PHP3.0 and Mysql
Categories : MySQL, HTML and PHP, PHP, Databases
 David Keaveny wrote :383
I hope I don`t need to point this out, but the line that 
reads 

while (list($id, $name) = $db_fetch_row($result))

should of course read

while (list($id, $name) == $db_fetch_row($result))

since you`re testing for equivalence. Guess who got 
caught out by that one :-)