php if date is less then this date -- missing something simple?

Hello I have this..


$DEADdate = mktime(0, 0, 0, date("m")  , date("d")-1, date("Y"));
$DEADdateIs = trim($db->DbTimeStamp($DEADdate),"'");
$toMATCH = $row['event_date_start'];
/// $row['event_date_start']  == 2009-05-21 07:00:00
if($toMATCH < $DEADdateIs){
//the day is pasted
}

which doesn't work... any ideas on how to fix it... I sure I'm just missing something simple here

Thanks Jeremy
global $gCms;
	$db = &$gCms->db;
	$feusers = &$gCms->modules['FrontEndUsers']['object'];
	$uid = $feusers->LoggedInID();
	$groupI = $this->GetPreference('group','');
	$groupP = $feusers->GetGroupName($groupI);
	$result = array();	
	$uNameresult = array();		
	////up to this point I only have the user information so I need to get the groups they add join
	$query = "SELECT userid FROM ".
		cms_db_prefix()."module_feusers_belongs JOIN ".
		cms_db_prefix()."module_feusers_groups ON id=groupid where groupname='$groupP'";
	$dbresult = $db->Execute( $query );
	if($dbresult && $dbresult->RecordCount() > 0) {
		while ( $row = $dbresult->FetchRow() ) {
			array_push($result, $row['userid']);
		}
	}
	foreach($result as $uids){
		if($uids == $uid) {
			
			$query2 = "SELECT * FROM ".cms_db_prefix()."module_cgcalendar_events WHERE event_title LIKE '".$uid.":%'";
			$dbresult = $db->Execute( $query2 );
			if($dbresult && $dbresult->RecordCount() > 0) {
				while ( $row = $dbresult->FetchRow() ) {
					$DEADdate = mktime(0, 0, 0, date("m")  , date("d")-1, date("Y"));
					$DEADdateIs = trim($db->DbTimeStamp($DEADdate),"'");
					$toMATCH = $row['event_date_start'];
					if($toMATCH < $DEADdateIs){
						//echo 'true';
						$query = "DELETE FROM ".cms_db_prefix()."module_cgcalendar_events WHERE event_title LIKE '".$uid.":%' AND event_date_start=".$toMATCH."";
						$results = $db->Execute($query);
						if(!$results) {
						  echo 'Error: '.mysql_error();
						}else{
						}
					}
				}
			}
		}
	}

Open in new window

LVL 4
jeremyBass26Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

mstrelanCommented:
what format is $row['event_date_start'] and $db->DbTimeStamp($DEADdate); ?
make sure they are both INTs first... you can do this with strtotime() if they are some form of string
0
jeremyBass26Author Commented:
/// $row['event_date_start']  == 2009-05-21 07:00:00

which $DEADdateIs = trim($db->DbTimeStamp($DEADdate),"'"); is building the same as

$row['event_date_start']

was

This is hard to test casue it doesn't echo...


	foreach($result as $uids){
		if($uids == $uid) {
			
			$query2 = "SELECT event_date_start FROM ".cms_db_prefix()."module_cgcalendar_events WHERE event_title LIKE '".$uid.":%'";
			$dbresult = $db->Execute( $query2 );
			if($dbresult && $dbresult->RecordCount() > 0) {
				while ( $row = $dbresult->FetchRow() ) {
					$DEADdate = mktime(00, 00, 0, date("m")  , date("d")-1, date("Y"));
					$DEADdateIs = trim($db->DbTimeStamp($DEADdate),"'");
					$toMATCH = $row['event_date_start'];
					
					$DEADdateIsP = strtotime($DEADdateIs);
					$toMATCHP = strtotime($toMATCH);
 
					if($toMATCHP <= $DEADdateIsP){
						//echo 'true';
						$query = "DELETE FROM ".cms_db_prefix()."module_cgcalendar_events WHERE event_title LIKE '".$uid.":%' AND event_date_start=".$toMATCH."";
						$results = $db->Execute($query);
						if(!$results) {
						  echo 'Error: '.mysql_error();
						}else{
						}
					}
				}
			}
		}
	}

Open in new window

0
mstrelanCommented:
Can you add echos? Is this on a live server? Very dangerous but here's a tip if you need to test on a live server...

if ($_SERVER['REMOTE_ADDR'] = 'youripaddress') {
    echo('your debugging information here');
}

or if you've got a shared ip address you could try pass in a request variable in the query string eg   http://localhost/path/to/your/script.php?DEBUGMODE=TRUE
then

if (isset($_GET['DEBUGMODE'])) {
    echo('your debugging information here');
}
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

jeremyBass26Author Commented:
no I mean I can't echo do to that fact that it does a redircet so fast I don't get anything...
0
mstrelanCommented:
put exit; before the redirect
0
mstrelanCommented:
or directly after the echo
0
jeremyBass26Author Commented:
got it.. missing the '' around the date in the delete
0
jeremyBass26Author Commented:
fogot that to trun on debug... sorry.. was being dumb... thanks for the help
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.