Afternoon all,
I have written a page to pass info to another page which selects data from my DB.
All would be OK if you enforced a choice for each variable but as it is possible that someone will want to select matches just by Home Team and don't care about anything else.
Here is the code I plan to use;
$hometeam = $_GET[hometeam];
$awayteam = $_GET[awayteam];
$competition = $_GET[competition];
$division = $_GET[division];
$fixturedate = $_GET[date];
$link = mysql_connect($sql_server, $sql_username, $sql_password)
or die("Could not connect : " . mysql_error());
mysql_select_db($sql_database) or die("Could not select database");
$query = mysql_query("SELECT * FROM fixtures WHERE ( HomeTeam = '$hometeam' AND AwayTeam > '' AND Competition > '' AND Division >'' AND Date > '') OR ( HomeTeam > '' AND AwayTeam = '$awayteam' AND Competition > '' AND Division >'' AND Date > '') OR and so on..... ");
Because I don't know the mechanics of the SELECT statement can someone tell me if it simply works its way from first to last in the OR statement. If so, I guess I could simply start with ALL 5 being = and work down to none being equal.
Anyone got a quicker method. I will check back while I am writing the long way.
All the best,
Neil.