removeDate and mySQL count

3 posts by 2 authors in: Forums > CMS Builder
Last Post: August 31, 2014   (RSS)

By gregThomas - August 21, 2014

Hey Shawn,

The mysql_count function can take a where statement as it's second value, and this will be used to filter the results. In your case it would be used like this:

<?php
  //Get the current time and date in SQL format
  $currentDate = date('Y-m-d H:i:s'); 
  echo mysql_count('events',"`removeDate` >= '$currentDate'");
?>

So the first value is the section you want to count the values from, and the second value is the where statement. 

The where statement will only return items which have a remove date greater or equal today.

Thanks!

Greg

Greg Thomas







PHP Programmer - interactivetools.com

By shawn - August 31, 2014

Perfect! Thank you Greg :)