Page 1 of 1

Num rows help

Posted: Fri Feb 16, 2007 9:49 am
by icesolid
I have a MySQL database that has a field named date_ordered

I want to count the number of rows that exist AFTER 17 days older than todays date (older than 17 days). The code that I have put in below shows how I am attempting to do this now. I have no errors in the code, however the query is just telling me how many cases exist between ex: 2007-01-30 AND 2007-02-16. I want to know how many rows exist after ex: 2007-01-30

Code: Select all

<?php
$start_date1 = strtotime("-17 day");
$start_date1 = date("Y-m-d", $start_date1);
$end_date = date("Y-m-d");

echo mysql_num_rows(mysql_query("SELECT * FROM cases WHERE location_territory='Bronx' AND assigned='false' AND date_ordered BETWEEN '$start_date1' AND '$end_date'"));
?>

Posted: Fri Feb 16, 2007 10:49 am
by GeXus
You can do greater than.. so

Code: Select all

SELECT * FROM cases WHERE location_territory='Bronx' AND assigned='false' AND date_ordered > '$end_date'