Jump to content

[SOLVED] display table content with double search???


kemper

Recommended Posts

I would like to display schedules by team.  The best option I can think of to do so is to have two drop down menus.  First menu to select division, then search for specific team in the second menu.  Where do I start of this?  I have the schedule in a table with fields being:

status

division

gameid

date

time

home

h_score

visitor

v_score

field

field_no

 

I am not sure where to begin when scripting for double search [division and team (from home and visitor) fields].

 

Assistance is greatly appreciated!

i don't see a field in your table where it says "team"

 

and I don't see a field in your table that references to a team like "teamid"

 

so start off doing that, then you can simply query the table with a form

 

your WHERE clause is going to be the definitive variable

 

choosing to display WHERE team=$userchosenteam

 

hmm i think i understand what you mean by "double search"

try explaining yourself a little better next time

 

the problem here is that the where clause is going to CHANGE when a user selects to sort by either visitor or home

 

what you can do then is make ONE where clause variable that changes when different variables are added to it

 

when you post the options the user has selected

$home = $_POST['home'];
$visitor = $_POST['visitor'];

if ($home == "") {
$whereclause = "visitor='$visitor'";
}

if ($visitor == "") {
$whereclause = "home='$home'";
}

then in your query simply put the $whereclause in it

example: WHERE $whereclause

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.