Getting there... 🙂
$query = "SELECT min(game_date) FROM fixtures_second WHERE game_date>date() LIMIT 1";
$result = mysql_db_query("benrothwell", $query);
$query2 = "SELECT * FROM fixtures_second WHERE game_date = $result";
Allmost right, but you want to run the seconds query with the date you got from the first query.
So first you run the 1st query, then use mysql_fetch_array() to get the date.
Have a peek at this:
// Get the next fixture date
$sQuery = "SELECT min(game_date) AS nextdate FROM fixtures_second WHERE game_date>date() LIMIT 1";
// Check if the query worked or not
if (!$result = mysql_db_query("benrothwell", $sQuery))
{
// Query failed, diplay an error
echo mysql_error();
}
else
{
// Query worked, check if there were any results
if (mysql_num_rows($result)==0)
{
// No results, no next fixture
echo 'No fixtures found';
}
else
{
// Results found, fetch the date
$aRow = mysql_fetch_row($result,MYSQL_ASSOC);
$sNextFixtureDate = $aRow['nextdate'];
$sQuery2 = "SELECT * FROM fixtures_second WHERE game_date = '".$sNextFictureDate."'";
// Check if the query worked
if (!$result2 = mysql_db_query("benrothwell", $sQuery2))
{
// Query failed, diplay an error
echo mysql_error();
}
else
{
// Query worked, no need to check for results because we are fetching
// a row that we already found in the first query
$aRow2 = mysql_fetch_row($result2 ,MYSQL_ASSOC);
echo 'Next fixture date: '.$aRow2['game_date'];
};
};
};