
liomon41
Members-
Posts
37 -
Joined
-
Last visited
Never
Everything posted by liomon41
-
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>
-
Yeah my bad.... my bad ... really sorry about that
-
I'm trying call a jquery function based if a condition in php is true but the problem is the jquery runs whether the condition is true or not... Need help fixing this.... Thanks... <!doctype html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Show display...</title> <script src="scripts/jquery-1.7.min.js" type="text/javascript"></script> <style type="text/css"> .fadeOutbox{ float:left; padding:8px; margin:16px; border:1px solid red; width:200px; height:50px; background-color:#F00; color:white; } </style> </head> <body> <div class="fadeOutbox"> Click here to fadeOut div </div> <?php ini_set("display_errors","0"); ERROR_REPORTING(E_ALL); include 'config.php'; $query = "select secondteam from fixtures where id = '2' "; $result = mysql_query($query); while($row = mysql_fetch_array($result)) { $country = $row['firstteam']; if($country = "Poland"){ // by the way this happens to be false...... ?> <script type="text/javascript"> $(".fadeOutbox").click(function () { $(this).fadeOut('slow'); }); </script> <?php } } ?> </body> </html>
-
wow..... that worked perfectly well.... Thanks a bunch....
-
This is first time working with php and files, would love it if you explained in details how to really go about doing this from scratch... thanks
-
I have a form that has a dropdown menu and a button and the list values for the dropmenu are five countries (france, england, germany, spain, norway) and i also i have in a folder in my local server the flags for these five countries (france.jpg, england.jpg, germany.jpg, spain.jpg, norway.jpg) . The idea is for everytime a user select a country from the dropdown menu and clicks the button, the countries flag is displayed from the folder unto the page right next to the button... Any ideas how to go about this... really appreciate you guys helping out....
-
I'm sorry, im kinda new to this part of php, how do you compare the timestamp..... ???
-
I have a program that stores date and time for future events in the database, upon retrieving this information from the database, I'd like to know how to write a code to check if the current time is 1 hour prior to the time in the database.... any ideas..
-
I trying to write a code in php that they tells the user that they've got 1 hour before a specific time is reached...
-
table info ID firstName lastName DOB 1 Lionel Johnson 1990 2 Vincent Williams 1990 3 Gary Coleman 1985 4 John Liverpool 1903 5 Lilly White 1903 ##this is how i want the output to look like..... output 1990 Lionel Johnson Vincent Williams 1903 John Liverpool Lilly White 1985 Gary Coleman
-
Hey you guys ... i have table called info and it contains records of students ID, FirstName, LastName and DOB.... And there are some duplicates records in the DOB.. ***Please check attached word file...*** my question how do you query the database to display duplicate records first as shown in the output before displaying single records... thanks you guys... 18552_.doc