if($_POST['date1']=="" and $_POST['date2']=="" and $_POST['sub']!=""){
$sql=mysql_query("SELECT username,member_first,member_last FROM user WHERE subject_id='$_POST[sub]'");
list($user,$first,$last)=mysql_fetch_row($sql) or die(mysql_errno());
$c=count($user);
echo $c;
}
if($_POST['date1']=="" and $_POST['date2']=="" and $_POST['sub']!=""){
$sql=mysql_query("SELECT username,member_first,member_last FROM user WHERE subject_id='$_POST[sub]'");
list($user,$first,$last)=mysql_fetch_row($sql) or die(mysql_errno());
$c=count($user);
echo $c;
}
แก้เป็น Code (PHP)
if( $_POST['date1']=="" and $_POST['date2']=="" and $_POST['sub']!=""){
$c=0;
$sql=mysql_query("SELECT username,member_first,member_last FROM user WHERE subject_id='$_POST[sub]'");
while( $ro=mysql_fetch_row($sql)){
list($user,$first,$last)=$ro;
$c++;
}
echo $c;
}