$sql = "select `borrowing_return equipment`.*,`user`.* from `borrowing_return equipment`,`user` where `borrowing_return equipment`.user_id=`user`.user_id ";
if ($statuscheck) $sql .= " AND `borrowing_return equipment`.status_check='$status_check' ";
if ($rptstartdate) $sql .= " AND `borrowing_return equipment`.date_save between '$rptstartdate' AND '$rptenddate' ";
$sql .= " ORDER BY `borrowing_return equipment`.borrow_id DESC";
$query = mysql_query($sql) or die(mysql_error() .'<br/>'. $sql);