Note that there are some explanatory texts on larger screens.

plurals
  1. POMy query won't work when I add a date range to it. Using php and MySQL
    primarykey
    data
    text
    <p>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!</p> <p>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)</p> <p>It includes the part of the form that includes the date range.</p> <pre><code>&lt;li class="form-line form-line-column" id="id_29"&gt; &lt;label class="form-label-top" id="label_29" for="input_30"&gt; From Date: &lt;/label&gt; &lt;div id="cid_29" class="form-input-wide"&gt; &lt;input type="text" class="form-textbox validate" id="datepicker" name="from_date" size="10" /&gt; &lt;/div&gt; &lt;/li&gt; &lt;li class="form-line form-line-column" id="id_29"&gt; &lt;label class="form-label-top" id="label_29" for="input_8"&gt; To Date: &lt;/label&gt; &lt;div id="cid_29" class="form-input-wide"&gt; &lt;input type="text" class="form-textbox validate" id="datepicker2" name="to_date" size="10" /&gt; &lt;/div&gt; &lt;/li&gt; &lt;?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%'"); ?&gt; </code></pre> <p>This is the query I want:</p> <pre><code>&lt;?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 &gt;= '$startdate' AND created &lt;= '$enddate'"); ?&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload