Jump to content

Recommended Posts

I have a somewhat working code that I am trying to fine tune. I'm not too good at the ifs, ands, and buts  ;D .
In the script below you will see I am getting results from a schedules_scores table and I am showing the last game. What I am want to do is to check through schedules_scores table and get the last one which had scores entered into the table and display that. Any help would be greatly appreciated !

[sup]<?php
    $result_schedules_scores = mysql_query("SELECT * FROM schedule_scores WHERE season = '000000000001' ORDER BY 'date' DESC LIMIT 1");

$schedules_scores_date = mysql_result($result_schedules_scores,0,"date");
$schedules_scores_location = mysql_result($result_schedules_scores,0,"location");
$schedules_scores_team1 = mysql_result($result_schedules_scores,0,"team1");
$schedules_scores_team2 = mysql_result($result_schedules_scores,0,"team2");
$schedules_scores_team1score = mysql_result($result_schedules_scores,0,"team1_score");
$schedules_scores_team2score = mysql_result($result_schedules_scores,0,"team2_score");
           
echo "
    <tr>
      <td class=\"player_header\" valign=\"top\">
                 <b> $schedules_scores_date <br>
<tr>
      <td class=\"player_header\" valign=\"top\"><img src=\"/games/images/$schedules_scores_team1.jpg\" width=\"50\" border=\"1\" align=\"left\"></td>
  <td class=\"player_header\" valign=\"top\">           <img src=\"/games/images/$schedules_scores_team2.jpg\" width=\"50\" border=\"1\" align=\"left\"></td></b></td></tr>
<tr>
      <td class=\"player_header\" valign=\"top\">
                 <b> $schedules_scores_team1score </td>
<td class=\"player_header\" valign=\"top\">
                 <b> $schedules_scores_team2score </td></tr>
"
?>[/sup]
Link to comment
https://forums.phpfreaks.com/topic/22365-results-help/
Share on other sites

You'd need an additional column, of type timestamp.

This way your date column would hold the date of the match and the timestamp column would hold the time of the last update to the row.  You could 'ORDER BY' either.

An example would be that if a team played one week ago today, my date column would contain 21/09/2006 but your timestamp column would contain 28/09/2006 13:19.
[color=red][size=8pt]Note: Formats aren't accurate[/size][/color]

Regards
Huggie
Link to comment
https://forums.phpfreaks.com/topic/22365-results-help/#findComment-100185
Share on other sites

OK, let me put it another way...

[quote]What I am want to do is to check through schedules_scores table and get the last one which had scores entered into the table and display that.[/quote]

How do you know which the last one to have scores entered was?

Regards
Huggie
Link to comment
https://forums.phpfreaks.com/topic/22365-results-help/#findComment-100190
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.