I currently have multiple search fields within one form which the user can pick and choose which one to filter, everything works perfectly until I add the date range to it. If I add the date range alone without any other fields to filter it works so I know it is not that I am writing the query wrong. Please help me figure this out. THANKS!
This is the query that works: (Also for some reason doing SELECT * won't work, I have to type the name of all the fields I want to show)
It includes the part of the form that includes the date range.
<li class="form-line form-line-column" id="id_29">
<label class="form-label-top" id="label_29" for="input_30">
From Date:
</label>
<div id="cid_29" class="form-input-wide">
<input type="text" class="form-textbox validate" id="datepicker" name="from_date" size="10" />
</div>
</li>
<li class="form-line form-line-column" id="id_29">
<label class="form-label-top" id="label_29" for="input_8">
To Date:
</label>
<div id="cid_29" class="form-input-wide">
<input type="text" class="form-textbox validate" id="datepicker2" name="to_date" size="10" />
</div>
</li>
<?php
$sso = $_GET['sso'];
$assigned_to = $_GET['assigned_to'];
$case_status = $_GET['case_status'];
$startdate = $_GET['from_date'];
$enddate = $_GET['to_date'];
$subject = $_GET['subject'];
$sql = ("SELECT
id, sso, full_name, case_status, assigned_to, resolution,
description, updated, created, additional_notes, subject
FROM rmstable2
WHERE
sso LIKE '%$sso%' AND
case_status LIKE '%$case_status%' AND
assigned_to LIKE '%$assigned_to%' AND
subject LIKE '%$subject%'");
?>
This is the query I want:
<?php
$sql = ("SELECT
id, sso, full_name, case_status, assigned_to, resolution,
description, updated, created, additional_notes, subject
FROM rmstable2
WHERE
sso LIKE '%$sso%' AND
case_status LIKE '%$case_status%' AND
assigned_to LIKE '%$assigned_to%' AND
subject LIKE '%$subject%'
AND created >= '$startdate'
AND created <= '$enddate'");
?>
to_dateandfrom_datefields that come from PHP and also type ofcreatedfield?