Jump to content

Archived

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

matineebcn

Selecting results

Recommended Posts

I'm busy with a site and now i want to have a page with some info out of the database. Now the page already displays the information i need only there are 2 things. As first, it's about soccer matches, i want the script to select only the matches which are already started or already played. So it shouldn't show matches which are not started yet. As second i want it to be the last 5 matches played. Does anyone knows how to do that?

 

This is my coding until now;

[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]function GetResults() {

global $dbaseMatchData, $SID, $leagueID;

global $P, $W, $POS, $D, $D, $L, $Away, $Home, $F, $A, $GD, $Competition, $User_Name,$PTS,$Date,$Result, $FixturesResults;

 

// Create the connection to the database

$link = OpenConnection();

if ($link == FALSE) {

echo "Unable to connect to the dbase";

return;

}

 

$userquery = "SELECT * FROM $dbaseMatchData where lid='$leagueID' order by matchdate";

$userquery = "$userquery desc";

$userresult = mysql_query($userquery)

or die("Query failed: $userquery");

 

$date = GetDateFromDatetime(date("Y-m-d"));

 

// Display the username as a header.

echo "<table align=\"center\" class=\"STANDTB\">\n";

echo "<tr>\n";

echo "<td class=\"TBLHEAD\" colspan=\"7\" align=\"center\"><font class=\"TBLHEAD\">$FixturesResults</font></td>\n";

echo "</tr>\n";

echo "<tr>\n";

echo "<td width=\"80\" align=\"center\" class=\"TBLHEAD\"><font class=\"TBLHEAD\"><b>$Date</b></font></td>\n";

echo "<td width=\"125\" align=\"center\" class=\"TBLHEAD\"><font class=\"TBLHEAD\"><b>$Home</b></font></td>\n";

echo "<td align=\"center\" class=\"TBLHEAD\"><font class=\"TBLROW\"><b>G</b></font></td>\n";

echo "<td align=\"center\" class=\"TBLHEAD\"><font class=\"TBLROW\"><b>v</b></font></td>\n";

echo "<td align=\"center\" class=\"TBLHEAD\"><font class=\"TBLROW\"><b>G</b></font></td>\n";

echo "<td width=\"125\" align=\"center\" class=\"TBLHEAD\"><font class=\"TBLHEAD\"><b>$Away</b></font></td>\n";

echo "<td width=\"90\" align=\"center\" class=\"TBLHEAD\"><font class=\"TBLHEAD\"><b>$Competition</b></font></td>\n";

echo "</tr>\n";

// First loop. Used to get all the users.

while ($userline = mysql_fetch_array($userresult, MYSQL_ASSOC)) {

// For each user display all their predictions.

// against the actual result.

$matchid = $userline["matchid"];

$hometeam = stripslashes($userline["hometeam"]);

$awayteam = stripslashes($userline["awayteam"]);

$competitionformat = $userline["compformat"];

$homescore = $userline["homescore"];

if ($homescore == null) {

$homescore = " ";

}

$awayscore = $userline["awayscore"];

if ($awayscore == null) {

$awayscore = " ";

}

$date = $userline["matchdate"];

$datetext = GetDateFromDatetime($date);

 

echo "<tr>\n";

echo "<td class=\"TBLROW\"><font class=\"TBLROW\"><a href=\"showpredictionsformatch.php?sid=$SID&matchid=$matchid&date=$date\">$datetext</a></font></td>\n";

echo "<td class=\"TBLROW\"><font class=\"TBLROW\">$hometeam</font></td>\n";

echo "<td align=\"CENTER\" class=\"TBLROW\"><font class=\"TBLROW\">$homescore</font></td>\n";

echo "<td align=\"CENTER\" class=\"TBLROW\"><font class=\"TBLROW\">v</font></td>\n";

echo "<td align=\"CENTER\" class=\"TBLROW\"><font class=\"TBLROW\">$awayscore</font></td>\n";

echo "<td align=\"RIGHT\" class=\"TBLROW\"><font class=\"TBLROW\">$awayteam</font></td>\n";

echo "<td align=\"RIGHT\" class=\"TBLROW\"><font class=\"TBLROW\">$competitionformat</font></td>\n";

echo "</tr>\n";

}

echo "</table>\n";

 

CloseConnection($link);

}

 

Thanks to anyone who even only took the time to look at my problem.

Grtz,

Rick

Share this post


Link to post
Share on other sites

×

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.