strange behavior!!!!
Posted: Wed Mar 18, 2009 7:03 am
please take a look at my site:
http://tamouh-salesoffice.com/tamouh/re ... erator.php
try attendance - 1-3-2009 and 3-3-2009 ---- no results
try attendance - 1-3-2009 and 15-3-2009 ---- i get results but 17-3-2009!!!!!
form code
http://tamouh-salesoffice.com/tamouh/re ... erator.php
try attendance - 1-3-2009 and 3-3-2009 ---- no results
try attendance - 1-3-2009 and 15-3-2009 ---- i get results but 17-3-2009!!!!!
form code
resulsts code<html>
<head>
<script language="javascript" type="text/javascript" src="datetimepicker.js">
</script>
<script language='javascript'>
function verifyMe(){
var msg='';
if(document.getElementById('types').value==''){
msg+='- Chose Report Type\n\n';}
if(document.getElementById('startdate').value==''){
msg+='- Chose Start Date:\n\n';}
if(document.getElementById('enddate').value==''){
msg+='- Chose End Date:\n\n';}
if(msg!=''){
alert('The following fields are empty or invalid:\n\n'+msg);
return false
}else{
return true }
}
</script>
</head>
<body BGCOLOR="#A5B9C5">
<br><br><br><br><br>
<form name='Generate Report' action='theresults.php' method='POST' onsubmit='return verifyMe();'>
<table align="center" class='table_form_1' id='table_form_1' cellspacing='0'>
<tr>
<td class='ftbl_row_1' ><LABEL for='types' ACCESSKEY='none' ><b style='color:red'>*</b>Chose Report Type
</td>
<td class='ftbl_row_1a' ><select name='types' id='types'>
<option value='Attendance'>Attendance</option>
<option value='Employee Records'>Employee Records</option>
<option value='Helipad'>Helipad</option>
<option value='Events'>Events</option>
<option value='Inventory Usage'>Inventory Usage</option>
<option value='Inventory Quantity'>Inventory Quantity</option>
</select>
</td>
</tr>
<tr>
<td class='ftbl_row_2' ><LABEL for='startdate' ACCESSKEY='none' ><b style='color:red'>*</b>Chose Start Date: - Formate (dd/mm/yyyy)
</td>
<td class='ftbl_row_2a' ><input type='text' name='startdate' id='startdate' size='23' value=''><a href="javascript:NewCal('startdate','ddmmyyyy')"><img src="cal.gif" width="16" height="16" border="0" alt="Pick a date"></a>
</td>
</tr>
<tr>
<td class='ftbl_row_1' ><LABEL for='enddate' ACCESSKEY='none' ><b style='color:red'>*</b>Chose End Date: - Formate (dd/mm/yyyy)
</td>
<td class='ftbl_row_1a' ><input type='text' name='enddate' id='enddate' size='23' value=''><a href="javascript:NewCal('enddate','ddmmyyyy')"><img src="cal.gif" width="16" height="16" border="0" alt="Pick a date"></a>
</td>
</tr>
<tr>
<td colspan='2' align='right'><input type='submit' name='submit' value='Submit'> <input type='reset' name='reset' value='Reset'>
</td>
</tr>
</table>
</form>
</body>
</html>
<html>
<body BGCOLOR="#A5B9C5">
</body>
</html>
<?php
$thetype=$_POST['types'];
$thestartdate = $_POST['startdate'];
$thestartdate1 = date('Y-m-d', strtotime($thestartdate));
$theenddate=$_POST['enddate'];
$theenddate1 = date('Y-m-d', strtotime($theenddate));
$host="my.com";
$db_name="mydb";
$username="mydb";
$password="008";
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
if ($thetype == "") {
}
elseif ($thetype == "Attendance") {
$sql= "SELECT *,date_format(thedate , '%d/%m/%Y') as thedate FROM attendance WHERE thedate >='$thestartdate1' and thedate <= '$theenddate1'" or die(mysql_error());
$result = mysql_query($sql) or die('Query failed. ' . mysql_error());
if (mysql_num_rows($result) >= 1) {
echo ' ';
echo '<table border="1">';
echo '<tr>';
echo '<th>';
echo 'ID';
echo '</th>';
echo '<th>';
echo 'Name';
echo '</th>';
echo '<th>';
echo 'Position';
echo '</th>';
echo '<th>';
echo 'Emp#';
echo '</th>';
echo '<th>';
echo 'Notes';
echo '</th>';
echo '<th>';
echo 'Date';
echo '</th>';
echo '<th>';
echo 'Day';
echo '</th>';
echo '<th>';
echo 'IN';
echo '</th>';
echo '<th>';
echo 'OUT';
echo '</th>';
echo '<th>';
echo 'BreakHrs';
echo '</th>';
echo '<th>';
echo 'RegularHrs';
echo '</th>';
echo '<th>';
echo 'WorkHrs';
echo '</th>';
echo '<th>';
echo 'Details';
echo '</th>';
echo '</tr>';
while($row = mysql_fetch_assoc($result))
{
echo '<tr><td>'.$row['AttendanceID'].'</td><td>'.$row['thename'].'</td><td>'.$row['theposition'].'</td><td>'.$row['emp#'].'</td><td>'.$row['thenote'].'</td><td>'.$row['thedate'].'</td><td>'.$row['theday'].'</td><td>'.$row['time_in'].'</td><td>'.$row['time_out'].'</td><td>'.$row['break_hrs'].'</td><td>'.$row['reg_hrs'].'</td><td>'.$row['worked_hrs'].'</td><td>'.$row['work_description'].'</td></tr>';
}
echo '</table>';
}
exit;
}