tourer Posted December 11, 2009 Share Posted December 11, 2009 hi friends. i am working on a php which would be added up to the scheduled tasks. This php will compare the Current server time & the endtime fetched from the database. Suppose endtime field consists of 8 values & anyone value is equal to the currnt time, then the php page will execute a script. Here is my humble try so far. But i am able to fetch value, but when i echo the results, the result for all the condition is displayed:_ endtime.php:- <?php date_default_timezone_set('Asia/Kolkata'); $dbhost = 'localhost'; $dbuser = 'root'; $dbpass = 'XXXX'; $conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql'); $dbname = 'fsdfsd'; mysql_select_db($dbname,$conn) or die ("could not open db".mysql_error()); //$Tdate = date('H') * 60 + date('i'); //$site = "http://118.102.191.40/experiments/e1.html"; $Tdate = 720; $sql = "SELECT endtime FROM reservations"; $result = mysql_query($sql) or die('Query failed. ' . mysql_error()); //Fetch Data and use $row to get fields data While ($row = mysql_fetch_array($result)) { //echo "End Time: ".$row['endtime']; //} if ($Tdate == $row["endtime"]) { echo "Yeah, Gud Going"; //exit($site); } else { echo "Work Hard"; } } ?> the Result it displays:- Work HardWork HardYeah, Gud GoingWork HardWork HardWork Hard This shows that 720 is my 3rd entry from the bottom. Although i want the php to fetch all the table endtime Value's, Compare them with current server time, if any value matches, then a specified html page needs to be exited. Also can some one lead me through this exit stuff. Now this html page is running a swf file. The user books a slot to use this swf file. He mentions a starttime & endtime. Now the entering mechanism i have installed n started up. This endtime php will check the end time & force the html to exit. so is it possible to run some php scheduled for every 5 min, to end a html webpage at any remote PC. Cuz it is running through my Webserver. Can i abort that page whenever i want..... Quote Link to comment https://forums.phpfreaks.com/topic/184738-mysql-query-to-fetch-compare/ Share on other sites More sharing options...
tourer Posted December 11, 2009 Author Share Posted December 11, 2009 Any help please. I have stuck completly here.. Quote Link to comment https://forums.phpfreaks.com/topic/184738-mysql-query-to-fetch-compare/#findComment-975307 Share on other sites More sharing options...
fenway Posted December 14, 2009 Share Posted December 14, 2009 I don't follow. Quote Link to comment https://forums.phpfreaks.com/topic/184738-mysql-query-to-fetch-compare/#findComment-977274 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.