Jump to content

Comparison Operator with LIKE possible??


dmhall0

Recommended Posts

I need to pull data from a MySQL table that has a datetime field.

The user selects 2 dates, a start and stop, and I need to filter the data by everything between and including those dates.

The LIKE doesn't seem to work with a comparison operator.

Here is what I have.

 


$start_date = '2012-01-01';
$end_date = '2012-02-28';

$query = "SELECT ship_date, sku, shipqty, fgt_cost
  FROM shipments
  WHERE ship_date >= LIKE '$start_date%'
  AND ship_date <= LIKE '$end_date%'";

 

How can I make this work?

Thanks!!

Link to comment
https://forums.phpfreaks.com/topic/259005-comparison-operator-with-like-possible/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.