
liomon41
Members-
Posts
37 -
Joined
-
Last visited
Never
Profile Information
-
Gender
Not Telling
liomon41's Achievements

Member (2/5)
0
Reputation
-
okay ... what about this part of the query ... IF(SUBTIME(TIMESTAMP(`date`, `time`), '1:0:0') > NOW(), 1, 0)
-
Can anyone please explain to me in details(if possible) what this query does.. $query = "SELECT firstTeam, secondTeam, gameId, date, time, IF(SUBTIME(TIMESTAMP(`date`, `time`), '1:0:0') > NOW(), 1, 0) as active FROM fixtures ORDER BY date, time"; having issues with "as active" , never used that before, need your help... thanks
-
okay .. so is there a way you can find out what time is it in your local server ??
-
I need to write a script in php that lets you know what timezone you are in ... help.....
-
The code below allows users to access a particular page 1 hour prior to a given time and date else the link the page would be disabled. Thanks to some you guys on this forum i was able to achieve this.. But i kinda forgot mention that the time been retrieve from the db has to in GMT... The idea is whatever timezone you are right now, you comparing your current to the GMT($time) in the db... and ideas??? ...//// code.... <?php //Function to create a link or not based upon 'active' status function forecastLink($text, $url, $id, $clickable) { if(!$clickable) { return $text; } return "<a href='{$url}' id='{$id}'>{$text}</a>"; } //Create var to hold output $output = ''; //Create/run query for all records ordered by date $query = "SELECT firstTeam, secondTeam, gameId, date, time, IF(SUBTIME(TIMESTAMP(`date`, `time`), '1:0:0') > NOW(), 1, 0) as active FROM fixtures ORDER BY date, time"; $result = mysql_query($query); //Create flag variable to keep track of date $currentDate = false; while($row = mysql_fetch_array($result)) { //Convert date to common format $displayDate = date("D, M j, Y", strtotime($row['date'])); //Check if this is a new date if($currentDate != $displayDate) { //Display date header $currentDate = $displayDate; $output .= "<tr><td colspan='8' align='left' class='td'><b>{$currentDate}</b></td></tr>"; } //Extract and process the data for display $first = htmlspecialchars($row['firstTeam']); $second = htmlspecialchars($row['secondTeam']); $gameid = $row['gameId']; $linkActive = $row['active']; $real_time = date("H:i", strtotime($row['time'])); //Display record $url = "forecast.php?first1={$first}&second1={$second}&game_id={$gameid}"; $output .= "<tr class='big'>\n"; $output .= "<td width='56' align='left' style='color:#709b52;'><a href='' class='result_hover'>results</a></td>\n"; $output .= "<td width='182' align='right'>" . forecastLink($first, $url, 'fixtures_f', $linkActive) . "</td>\n"; $output .= "<td width='-31' align='center'>" . forecastLink('vs', $url, 'fixtures_v', $linkActive) . "</td>\n"; $output .= "<td width='-12' align='left'>" . forecastLink($second, $url, 'fixtures_s', $linkActive) . "</td>\n"; $output .= "<td>" . forecastLink($real_time, $url, 'fixtures_t', $linkActive) . "</td>\n"; $output .= "</tr>\n"; } ?> <table width="525" border="1" cellpadding="40" height="63" > <?php echo $output; ?> </table>
-
the $time from the database is in GMT, so whatever timezone you are in, you are checking if your current time is (-1 GMT($time)) ... I did this in the very first code i sent to you.... $timeMinus1Hour = gmdate("H:i", strtotime("-1 hour", strtotime($time)));
-
what do you mean a different post???
-
everything checks out well but what i forgot to tell you was that the time in the database must be in GMT... really sorry i omiitted that part out....
-
yeah i did ... im working on it right now... thanks..
-
The reason i have two queries is cos there are two with the same date but different times so the first query select the date from the fixtures table, displays it then the second query selects the records that applies to that date..... I uploaded a copy of my fixtures table... would really appreciate it if you took a look at it, maybe you'd get what im trying to achieve... Thanks for your replies so .. 18587_.zip
-
is there another way of comparing currenttime with $$timeMinus1Hour and currentdate with the date from the database.. ?
-
the problem is the link are still active .... even when the time is reached... just can't seem to disable them... I think it has something to do with the comparison i used..
-
is that going to be a problem ??/
-
really sorry for posting multiple entries earlier on .... had some network issues... really didn't mean to ...
-
I'm working on a program that allows a user to access a particular page via href at a particular date and time... the idea is if the date given is reached and the current time is 1 hour prior to the time given, the link to access the page is disabled...so basically the link is active until 1 hour prior to the given time. I'm having issues comparing the date and time to make this happen... The code below shows what i have done so far and offcourse its working as it should... Need help with this you guys... Thanks alot.... <table width="525" border="0" cellpadding="40" height="63" > <?php $query = "select * from fixtures group by date having count(*) > 1"; $result = mysql_query($query); while($row = mysql_fetch_array($result)) { $date= $row['date']; $oDate = strtotime($date); $sDate = date("D M j Y",$oDate); ?> <tr><td colspan="8" align="left" class="td"><b><?php echo $sDate; ?></b></td></tr> <?php $query2 = "select * from fixtures where date = '$date'"; $result2 = mysql_query($query2); while($row2 = mysql_fetch_array($result2)) { $first = $row2['firstTeam']; $second = $row2['secondTeam']; $time = $row2['time']; $gameid = $row2['gameId']; $date_now = date("Y-m-d"); $time_now = gmdate("H:i:s"); $time2 = strtotime($time); $real_time = date("H:i", $time2); $timeMinus1Hour = gmdate("H:i", strtotime("-1 hour", strtotime($time))); if( $date <= $date_now && $time_now <= $timeMinus1Hour) { ?> <script type="text/javascript"> $('#fixtures').click(function (){ return false; }); </script> <tr class="big"> <td width="56" align="left" style="color:#709b52;"><a href="" class="result_hover">results</a></td> <td width="182" align="right"><a href="forecast.php?first1=<?php echo $first; ?>&second1=<?php echo $second; ?>&game_id=<?php echo $gameid; ?>" id="fixtures"> <?php echo $first; ?></a></td> <td width="-31" align="center"><a href="forecast.php?first1=<?php echo $first; ?>&second1=<?php echo $second; ?>&game_id=<?php echo $gameid; ?>" id="fixtures">vs</a></td> <td width="-12" align="left"><a href="forecast.php?first1=<?php echo $first; ?>&second1=<?php echo $second; ?>&game_id=<?php echo $gameid; ?>" id="fixtures"><?php echo $second; ?></a></td> <td><a href="forecast.php" id="fixtures"><?php echo $real_time; ?></a></td> </tr> <?php } } } ?> </table>