kemper Posted March 11, 2007 Share Posted March 11, 2007 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! Quote Link to comment https://forums.phpfreaks.com/topic/42187-solved-display-table-content-with-double-search/ Share on other sites More sharing options...
dsaba Posted March 11, 2007 Share Posted March 11, 2007 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 Quote Link to comment https://forums.phpfreaks.com/topic/42187-solved-display-table-content-with-double-search/#findComment-204633 Share on other sites More sharing options...
kemper Posted March 11, 2007 Author Share Posted March 11, 2007 teams are "home" and "visitor" fields Maybe I have to setup my table a different way, but not sure what is the best way. Quote Link to comment https://forums.phpfreaks.com/topic/42187-solved-display-table-content-with-double-search/#findComment-204634 Share on other sites More sharing options...
dsaba Posted March 11, 2007 Share Posted March 11, 2007 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 Quote Link to comment https://forums.phpfreaks.com/topic/42187-solved-display-table-content-with-double-search/#findComment-204636 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.