Ok this is my problem. I got a web interface, from which a user is able to make selection (all these selections are done from drop down menus) based upon the selection made the requisite data is pulled from the database. The DB consists of 3 tables that the data can be pulled from.
THE TABLES ARE
detail
ID | submit_date | submit_time | subject | details
where ID is the Primary Key (PK)
node
ID | submit_date | submit_time |node
where ID is the PK and Foreing Key (FK) that references the detail table
user
ID | submit_date | submit_time | user_fname |user_lname
where ID is the PK and FK that references the detail table
NOTE:
ID is of data type AUTO_INCREMENT
submit_date and submit_time are the same in all 3 tables
submit_date is in the form YYYY-MM-DD example 2004-07-22
submit_time is in the form HH:MM:SS example 18:05:06 (the time in the table is in 24 hour format not 12 hour format)
(the data in theze tables are from info. submmitted in a web form )
From the web interface theze are the selections that the user can make
NODE
USER
DAY
MONTH
YEAR
HOUR
MINUTE
SECOND
AM
PM
NOTE : that the above represents 10 different drop down menu from which the user can either make selections from ALL the menus or ANY subset of selections. So for example the user is sppose to be able to select a NODE and also select AM this would result in all records from the DB where:
node = NODE SELECTED BY THE USER
AND
time = ALL TIMES THAT END WITH AM example (10:19:12 AM)
Upon pressing a button on the web interface the above data (that user requested is displayed as follows)
ID# | NODE | USER | DATE | TIME | SUBJECT | VIEW DETAILS
If a record exist (in the D😎 for the query that the user made that record will have the above associated data (i.e ID#,NODE,USER,DATE,TIME,SUBJECT and VIEW DETAILS)
USER = user_fname , user_lname
(VIEW DETAILS is an HTML LINK that when pressed opens another page...I already got that working 😃 😃 😃 😃 )
The drop down menus are created as follows ():
echo "<select name=\"select_node\" tabindex=\"1\">";
echo "<option value=\"blank\">NODE</option>";
echo "<option value=\"NODE1\">NODE1</option>";
echo "<option value=\"NODE2\">NODE2</option>";
.
.
.
echo"</select>";
NOTE : value of the value attribute in the option tag all the selection have that line, I wuz thinking of using it to determine if something wuz selected :?:
The problem is how do I determine what the user selected ? Or mayB I should ask what is the best way to determine that ? Upon determinig what the user selected how do I then generate the appropriate query considering there are 10 possible selections that can be made and that the requisite data resides in 3 different tables ?
Do I use a bunch if statements to check what wuz selected then based on what I supposedly determine is selected then use another bunch of if statements to some how generate the requisite query...since there are 10 possible selections and the data is being pulled from 3 tables how do I kno in advance what queries to write ? Do I try writing every possible query to match every possible selection the user can make ?
I'm using MySQL 4.0.20 on a Sun Box and PHP 4.2.2 on a Win2k Box