OK, basically I want to check the DB against the elearningid... if the elearningid startdate and enddate are valid, continue, else redirect to expired.php...

EXAMPLE:

<?php
function TimeBomb() 
{ 
      rs = sql.Execute(" SELECT * FROM elearning WHERE elearningid=@elearningid AND GetDate() BETWEEN startdate AND enddate ");
      if (rs.RowCount > 0)
      {
           return true;
      }
      else
      {
           return false;
      }
 }
 if (! TimeBomb())
      {
           header("Location: expired.php");
      }
}

?>

Anyone have any ideas what I'm missing...

Thanks,
Ted

I realized I wasn't using the Date function coorectly... But it still doesn't work...

<?php
function TimeBomb()
{ 
      rs = sql.Execute(" SELECT * FROM elearning WHERE elearningid=@elearningid AND DATE_SUB(enddate - startdate) ");
      if (rs.RowCount > 0)
      {
           return true;
      }else{
           header("Location: expired.php");
           exit;
      }
}
?>

This almost looks like you're trying to work with a java or javascript object instead of php.

In PHP it would be something like:

$rs = $sql->Execute('SELECT ... ');
if( $rs->rowCount > 0 )
{
     return true;
}
else
{
    header('Location: expired.php');
    exit;
}

Are you getting any errors if you add error_reporting( E_ALL ); to the top of your php code?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.