0

am trying to create a filter,but am geting no result with this,my data type in mysql is date.Any help pls?

<?php		
        
		$date = "";
		$driver = "";
		$vreg = "";
		$desti = "";
		
		$radiotype = $_REQUEST['find'];		
		
		if ($radiotype == "")
		{
		echo"<p class='bodytxt'>N.B: You can filter by selecting any of the movement log you want to view.</p><br><br>
		";
		exit();
		}
		if($radiotype == "driver")

		{				
		
					$date_out = "";
					$date_in =  "";
					$date_out = $_REQUEST['date_out'];
					$date_in = $_REQUEST['date_in'];
					list($d, $m, $y) = split('[/.-]', $date_out);
					list($ed, $em, $ey) = split('[/.-]', $date_in);
					$date_out = $y."-".$m."-".$d;
					$date_in = $ey."-".$em."-".$ed;

$query = "SELECT * FROM movlog WHERE driver='$driver' BETWEEN ('$date_out') AND ('$date_in')";


	$pager = new PS_Pagination($conn,$query,10,10);
	$accra = $pager->paginate();
										    while($row = mysql_fetch_assoc($accra)) 
										
										
											
		$id = $row['id'];
		$mileage_out = $row['mileage_out'];
		$mileage_in = $row['mileage_in'];
		$vreg = $row['vreg'];
		$ftype = $row['ftype'];
		$famount = $row['famount'];
		$driver = $row['driver'];
		$vtype = $row['vtype'];
		$dept = $row['dept'];
		$date_out = $row['date_out'];
		$date_in = $row['date_in'];
		$time_out = $row['time_out'];					
		$time_in = $row['time_in'];
		$tt_con = $row['tt_con'];
		$tf_con = $row['tf_con'];

		}
			   
			   echo
			       "
				   
<table width='100%' align='center' border='0' cellspacing='1' cellpadding='1'>
<tr>
	<td width='12.5' align='center' valign='middle' bgcolor='#009933' class='bodytxt'><font color='#ffffff'>$vreg</font></td>
							
	<td width='12.5' align='center' valign='middle' bgcolor='#009933' class='bodytxt'><font color='#ffffff'>$date_out</font></td>
							
	<td width='12.5' align='center' valign='middle' bgcolor='#009933' class='bodytxt'><font color='#ffffff'>$date_in</font></td>
							
	<td width='12.5' align='center' valign='middle' bgcolor='#009933' class='bodytxt'><font color='#ffffff'>$famount</font></td>
							
	<td width='12.5' align='center' valign='middle' bgcolor='#009933' class='bodytxt'><font color='#ffffff'>$driver</font></td>
							
	<td width='12.5' align='center' valign='middle' bgcolor='#009933' class='bodytxt'><font color='#ffffff'>$vreg</font></td>
							
	<td width='12.5' align='center' valign='middle' bgcolor='#009933' class='bodytxt'><font color='#ffffff'>$driver</font></td>
							
	<td width='12.5' align='center' valign='middle' bgcolor='#009933' class='bodytxt'>
	<a href='trim.php?nav=view&id=$id&zy9stxyw...' target='_blank'><img src='icon/view.gif' border='0'></a></td>
   </tr>
</table>
				  
				  ";
                           
		?>
2
Contributors
3
Replies
4
Views
5 Years
Discussion Span
Last Post by pritaeas
0
$query = "SELECT * FROM movlog WHERE driver='$driver' BETWEEN '$date_out' AND '$date_in'";

Make sure that your variables are in the format yyyy-mm-dd and date_out is smaller than date_in.

If that still doesn't work, echo your query, and try it in phpmyadmin.

0

my date type is [datetime]

and format yyyy-mm-dd is [yyyy-mm-dd]

Edited by accra: n/a

0

Missed something:

$query = "SELECT * FROM movlog WHERE driver='$driver' AND date_column BETWEEN '$date_out' AND '$date_in'";
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.