Hey all, I'm trying to display a count of records entered by a data entry employee we have, using two text boxes to choose dates.
data_entry.php:
<?php
require('include/dbconnection.php');
echo "<form action='data_entry.php' method=post name='dataentry'>
<table>
<tr><td>
Start Date:</td><td>
<input type=text name='strt'>
</td></tr>
<tr><td>
End Date:</td><td>
<input type=text name='end'>
</td></tr>
<tr><td><input type=submit name='doit' value='Go!'></td></tr>
</table>";
$strt = $_POST['strt'];
$end = $_POST['end'];
echo $strt;
echo "<br>";
echo $end;
$sql = 'SELECT count(tblClaims.Processed_by) as michaeldone, DispatchDate FROM tblClaims WHERE Processed_by LIKE "Micheal" AND DispatchDate BETWEEN ". $strt ." AND ". $end ." GROUP BY DispatchDate';
// Michael is spelled wrong in our DB, so that's not the problem with the query...
$results = mysql_query($sql) or die("SQL ERROR: ".mysql_error());
$numrows = mysql_num_rows($results);
if(empty($numrows)) { // no rows returned
echo "Nothin!";
}else{
$michaeldone = mysql_result($results, 0);
echo $michaeldone;
}
?>
Echoing strt and end shows the dates I entered, but when I run the query I get 'Nothin!'
Is the concat format in the query wrong? Or am I just missing something simple?
Thanks, J
PS> I have to use <form action='data_entry.php'> because $_SERVER['PHP_SELF'] doesn't work...