error คับ
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'order by dtfirst desc' at line 1[SELECT * From tbnum WHERE order by dtfirst desc]
$sql = "SELECT * From tbnum WHERE ";
if($_POST['F']=='' and $_POST['L']==''){
$sql .= " 1 ";
}elseif($_POST['F']!='' and $_POST['L']!=''){
$sql .=" newdate between '{$_POST["F"]}-{$_POST["L"]}' and '{$_POST["F"]}-{$_POST["L"]}' ";
}
$sql .=" order by dtfirst desc";
$dbquery = mysql_query($sql) or die(mysql_error()."[$sql]" );
$numsrows = mysql_num_rows($dbquery);
$sql = "SELECT * From tbnum WHERE ";
if($_POST['F']=='' and $_POST['L']==''){
$sql .= " 1 ";
}elseif($_POST['F']!='' and $_POST['L']!=''){
$sql .=" newdate between '{$_POST["F"]}' and '{$_POST["L"]}' ";
}
$sql .=" order by dtfirst desc";
$dbquery = mysql_query($sql) or die(mysql_error()."[$sql]" );
$numsrows = mysql_num_rows($dbquery);