Jump to content

PHP help on systemdate


pixeltrace

Recommended Posts

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!
Link to comment
Share on other sites

[!--quoteo(post=371200:date=May 4 2006, 06:13 AM:name=pixeltrace)--][div class=\'quotetop\']QUOTE(pixeltrace @ May 4 2006, 06:13 AM) [snapback]371200[/snapback][/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]
[code]
<?
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';
}
?>[/code]

Plz try this code
Link to comment
Share on other sites

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) [snapback]371209[/snapback][/div][div class=\'quotemain\'][!--quotec--]
[code]
<?
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';
}
?>[/code]

Plz try this code
[/quote]
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.