Jump to content


Photo

PHP help on systemdate


  • Please log in to reply
2 replies to this topic

#1 pixeltrace

pixeltrace
  • Members
  • PipPipPip
  • Advanced Member
  • 577 posts

Posted 04 May 2006 - 11:13 AM

guys, i need help on this.
i have posted this problem before and i thought i already came up with a solution
but its still not working.
what i wanted to happen in my script is that:
i have a data with corresponding dates.
so on my website, what i wanted to happen is
if the date of my data is >= to the systemdate
my site will load upcoming.php
but when the date of my data is < the systemdate
my site will load noupcoming.php.

below is my current script and what it does is,
it only loads the noupcoming.php whether my data
is >= or < the system date. i short its not functioning
to what i wanted it to be.
==========
<?
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';
}
?>
===============

hope you could help me with this. thanks a lot!

#2 ansarka

ansarka
  • Members
  • PipPipPip
  • Advanced Member
  • 128 posts
  • LocationCochin, Kerala, India

Posted 04 May 2006 - 11:49 AM

[!--quoteo(post=371200:date=May 4 2006, 06:13 AM:name=pixeltrace)--][div class=\'quotetop\']QUOTE(pixeltrace @ May 4 2006, 06:13 AM) View Post[/div][div class=\'quotemain\'][!--quotec--]
guys, i need help on this.
i have posted this problem before and i thought i already came up with a solution
but its still not working.
what i wanted to happen in my script is that:
i have a data with corresponding dates.
so on my website, what i wanted to happen is
if the date of my data is >= to the systemdate
my site will load upcoming.php
but when the date of my data is < the systemdate
my site will load noupcoming.php.

below is my current script and what it does is,
it only loads the noupcoming.php whether my data
is >= or < the system date. i short its not functioning
to what i wanted it to be.
==========
<?
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';
}
?>
===============

hope you could help me with this. thanks a lot!
[/quote]
<?
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=date("y-m-d", strtotime($uRow[event_date]));
$systemdate = date('y-m-d');
}
}
if ($eventdate >= $systemdate) {$urls = 'upcomingmain.php';}
else {
$urls = 'noupcoming.php';
}
?>

Plz try this code

EVEN THE WORD IMPOSSIBLE IS SAYING I' M' POSSIBLE

#3 pixeltrace

pixeltrace
  • Members
  • PipPipPip
  • Advanced Member
  • 577 posts

Posted 04 May 2006 - 04:31 PM

Thanks bro, i'll go ahead and try this one.



[!--quoteo(post=371209:date=May 4 2006, 06:49 AM:name=anuka)--][div class=\'quotetop\']QUOTE(anuka @ May 4 2006, 06:49 AM) View Post[/div][div class=\'quotemain\'][!--quotec--]
<?
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=date("y-m-d", strtotime($uRow[event_date]));
$systemdate = date('y-m-d');
}
}
if ($eventdate >= $systemdate) {$urls = 'upcomingmain.php';}
else {
$urls = 'noupcoming.php';
}
?>

Plz try this code
[/quote]





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users