PHP Classes

File: Instructions.txt

Recommend this page to a friend!
  Classes of mike condiff  >  MySQLDropDownCondiff  >  Instructions.txt  >  Download  
File: Instructions.txt
Role: Documentation
Content type: text/plain
Description: Documentation Instructions
Class: MySQLDropDownCondiff
Generate select input from MySQL query results
Author: By
Last change:
Date: 9 years ago
Size: 1,351 bytes


Class file image Download
Free use for all... do whatever you will to it.

I got tired of writing code for Select Drop Downs in forms so I decided to make an object. 

You feed it a SQL Query, a name for the select box, the Mysql field to be displayed, the mysql field to use as the value of each select option.

Optional fields for selected field and selected value.  Selected field is not yet implemented (and I'm not sure I ever will) but if you choose to have a value selected at the start of the form load (as in when you edit/update a record and want the records value selected) you would specify this in $selected_value.

You also need to DEFINE (SERVER_NAME, DB_USER, DB_PASSWORD, DB_NAME) in config.php which is included. This is not neccesary if you already have a Mysql connection.

Upon instantiating the SQLDropDown, you can choose to connect to Mysql using SQLDropDown(true) which will connect you to the Mysql DB (if you set everything up in config.php correctly).  If you already have a current mysql connection, just use SQLDropDown(false).

There's obviously room for improvement.  Like adding CSS to the drop down. However, it functions as I need it to.  Hopefully it will be useful to others.   

Please Email me with Questions / Comments / Suggestions ETC.  And please be nice, this is my first upload.

Mike Condiff