please help ..the date format in my datase is Y-m-d.. now i want to search by date..so in my textbox i need only to type
example:
data in the database: 2014-06-19
in the textbox search i will only type EITHER of the following : 06-19-2014 OR 06192014 (without the - and format is change)
here is the part of my code:
$searchString=clean(strtoupper($_POST['searchString']));
$searchString =date("Y-m-d", strtotime($searchString));
$query = "SELECT *
FROM po
WHERE (date = '$searchString') || (date LIKE '%$searchString%')";
$result = mysql_query($query);
echo "<table border=1 style='border-collapse: collapse' width=95%>";
echo "<tr class='tableheader'>
<td>DATE</td>
<td>P.O.#</td>
<td>SUPPLIER</td>
<td>AMOUNT</td>
<td>CODE</td>
<td></td>
<td></td>
</tr>";
while ($records = mysql_fetch_array($result)){
$poDateRetrieved = $records['date'];
$poDate=date("m-d-Y", strtotime($poDateRetrieved));
echo "<tr>
<td>{$records['poNo']}</td>
<td>$poDate</td>
<td>{$records['supplier']}</td>
<td>{$records['tAmount']}</td>
<td>{$records['code']}</td>
<td><a href=purchaseOrder.php?page=23?&poNo={$records['poNo']}>[UPDATE]</td>
<td><a href=purchaseOrder.php?page=24?&poNo={$records['poNo']}>[DELETE]</td>
</tr>";
}
echo "</table>";