pixeltrace Posted March 12, 2006 Share Posted March 12, 2006 guys, i need help on this one. kindly check[a href=\"http://www.sinagtala.net/sinag3/index1.php\" target=\"_blank\"]http://www.sinagtala.net/sinag3/index1.php[/a]check the events list in the upcoming events section that theyare already done, meaning they are already past events becauseof the date.i am having problem setting up the condition for the date of the events versus the system date.the information being shown in the upcoming events is inside an iframewhat i wanted to happen here is if there are no events with there corresponding dates that are equalto the system date or higher (meaning currentdate above) my if else condition will just change the display page on the iframe to noupcoming.php but if there is or are (no matter how few or many they are) it will change the displaypage on the iframe to upcomingmain.php=========== here is the script that i made but i can't get the right codes. <? include 'db_connect.php'; $uSql = "SELECT event_date FROM events"; $uResult = mysql_query($uSql, $connection); if(!$uResult){ echo 'no data found';}else{ while($uRow = mysql_fetch_row($uResult)){ $eventdate = $uRow[0]; $systemdate = date ();if ($eventdate >= $systemdate) {$upcomingmain = 'upcomingmain';}else {$upcomingmain = 'noupcoming';}?> <iframe id="upcomingmain" src="<? $upcomingmain ?>.php" width=302 height=225 marginwidth=0 marginheight=0 hspace=0 vspace=0 frameborder=0 scrolling=yes></iframe>====================hope you guys can help me with this. thanks in advance!!! Quote Link to comment https://forums.phpfreaks.com/topic/4730-help-on-setting-condition-for-date/ Share on other sites More sharing options...
litebearer Posted March 12, 2006 Share Posted March 12, 2006 what format is [code]$eventdate = $uRow[0];[/code]Lite... Quote Link to comment https://forums.phpfreaks.com/topic/4730-help-on-setting-condition-for-date/#findComment-16571 Share on other sites More sharing options...
pixeltrace Posted March 12, 2006 Author Share Posted March 12, 2006 is that wrong? i just assigned a variable for event_date ( uRow[0] ) any suggestions that would fix my problem?thanks! Quote Link to comment https://forums.phpfreaks.com/topic/4730-help-on-setting-condition-for-date/#findComment-16599 Share on other sites More sharing options...
greycap Posted March 12, 2006 Share Posted March 12, 2006 [!--quoteo(post=354111:date=Mar 12 2006, 12:58 AM:name=pixeltrace)--][div class=\'quotetop\']QUOTE(pixeltrace @ Mar 12 2006, 12:58 AM) [snapback]354111[/snapback][/div][div class=\'quotemain\'][!--quotec--]is that wrong? i just assigned a variable for event_date ( uRow[0] ) any suggestions that would fix my problem?thanks![/quote]SELECT event_date FROM events WHERE event_date >= SYSDATE() Quote Link to comment https://forums.phpfreaks.com/topic/4730-help-on-setting-condition-for-date/#findComment-16619 Share on other sites More sharing options...
pixeltrace Posted March 14, 2006 Author Share Posted March 14, 2006 greycap,thanks it work!....but just on the sql query part.how can i make a condition wherein if there are no data wherein theevent_date >= sysdate ()a word saying "no new updates" will appear on the screenelse if there are datas >= sysdate ()it will just show the data content from the databasethank in advance!! Quote Link to comment https://forums.phpfreaks.com/topic/4730-help-on-setting-condition-for-date/#findComment-17444 Share on other sites More sharing options...
shortj75 Posted March 14, 2006 Share Posted March 14, 2006 try puttin youyour if statement into a function[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]function gotopage($url){if ($eventdate >= $systemdate) {$url = 'upcomingmain.php';}else {$url = 'noupcoming.php'; } }?><iframe id="upcomingmain" src="<? echo "gotopage($url)";?>.php" width=302 height=225 marginwidth=0 marginheight=0 hspace=0 vspace=0 frameborder=0 scrolling=yes></iframe>[/quote]or something along that line hope this helps it might need some tweeking but in the end it should do what you want Quote Link to comment https://forums.phpfreaks.com/topic/4730-help-on-setting-condition-for-date/#findComment-17453 Share on other sites More sharing options...
pixeltrace Posted March 15, 2006 Author Share Posted March 15, 2006 bro,i can't make it workhere is the script that i made using the scripts that you've provided============== <? include 'db_connect.php'; $uSql = "SELECT event_date FROM events"; $uResult = mysql_query($uSql, $connection); if(!$uResult){ echo 'no data found';}else{ while($uRow = mysql_fetch_row($uResult)){ $eventdate = $uRow['event_date']; } }?> <? function gotopage($urls){ if ($eventdate >= $sysdate()) {$urls = 'upcomingmain.php';} else { $urls = 'noupcoming.php';} } ?> <iframe id="upcomingmain" src="<? echo "gotopage($urls)";?>.php" width=302 height=225 marginwidth=0 marginheight=0 hspace=0 vspace=0 frameborder=0 scrolling=yes></iframe>========================are the variables that i have assigned is correct? what else needs to be done here?thanks !!!! Quote Link to comment https://forums.phpfreaks.com/topic/4730-help-on-setting-condition-for-date/#findComment-17651 Share on other sites More sharing options...
shortj75 Posted March 15, 2006 Share Posted March 15, 2006 sorry i forgot to remove .php from your i frame [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]<iframe id="upcomingmain" src="<? echo "gotopage($urls)";?>.php" width=302 height=225 marginwidth=0 marginheight=0 hspace=0 vspace=0 frameborder=0 scrolling=yes></iframe>[/quote]with this code it would be calling for a page like this yourpage.php.php so it it wont work unless your page had 2 php extentions sorry about that try it like this [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]<iframe id="upcomingmain" src="<? echo "gotopage($urls)";?>" width=302 height=225 marginwidth=0 marginheight=0 hspace=0 vspace=0 frameborder=0 scrolling=yes></iframe>[/quote] this should work if it doesnt try to change because that code should do what you want Quote Link to comment https://forums.phpfreaks.com/topic/4730-help-on-setting-condition-for-date/#findComment-17723 Share on other sites More sharing options...
pixeltrace Posted March 15, 2006 Author Share Posted March 15, 2006 bro,its still not working.... :((could you try checking my codes if everything that's in here is correct?=========<?include 'db_connect.php';$uSql = "SELECT event_date FROM events";$uResult = mysql_query($uSql, $connection);if(!$uResult){echo 'no data found';}else{while($uRow = mysql_fetch_row($uResult)){$eventdate = $uRow['event_date'];$systemdate = sysdate();}}function gotopage($urls){if ($eventdate >= $systemdate) {$urls = 'upcomingmain.php';}else {$urls = 'noupcoming.php'; }}?> <iframe id="upcomingmain" src="<? echo "gotopage($urls)";?>" width=302 height=225 marginwidth=0 marginheight=0 hspace=0 vspace=0 frameborder=0 scrolling=yes></iframe>==============thanks a lot!!bro,i was able to make it work. but without the function=========<?include 'db_connect.php';$uSql = "SELECT event_date FROM events";$uResult = mysql_query($uSql, $connection);if(!$uResult){echo 'no data found';}else{while($uRow = mysql_fetch_row($uResult)){$eventdate = $uRow['event_date'];$systemdate = date('y-m-d');}}if ($eventdate >= $systemdate) {$urls = 'upcomingmain.php';}else {$urls = 'noupcoming.php'; }?> <iframe id="upcomingmain" src="<?=$urls;?>" width=302 height=225 marginwidth=0 marginheight=0 hspace=0 vspace=0 frameborder=0 scrolling=yes></iframe>================thanks for the help!!! Quote Link to comment https://forums.phpfreaks.com/topic/4730-help-on-setting-condition-for-date/#findComment-17865 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.