谁能看到我在这里做错了什么?我试图根据数据库中字段的值包含某个页面。
我有 2 张桌子要检查,
如果用户名出现在 table.1 和 field.units = days inlcude days.php
如果用户名出现在 table.1 和 field.units = hours inlcude hours.php
如果用户名出现在 table.2 和 field.units = days inlcude days.php
如果用户名出现在 table.2 和 field.units = hours inlcude hours.php
$username = $USER->firstname.' '.$USER->lastname;
echo $username;
$is_academic_result = mysql_query('SELECT * from holiday_entitlement_academic where employee = '.$username.'');
$is_business_result = mysql_query('SELECT * from holiday_entitlement_business_manual where employee = '.$username.'');
if(mysql_num_rows($is_academic_result) > 0){
while($is_academic = mysql_fetch_array($is_academic_result)) {
if ($is_academic['units'] == 'days'){include('days.php');}
else if ($is_academic['units'] == 'hours'){include('hours.php');}
}
}
else if(mysql_num_rows($is_business_result) > 0){
while($is_business = mysql_fetch_array($is_business_result)) {
if ($is_business['units'] == 'days'){include('days.php');}
else if ($is_business['units'] == 'hours'){include('hours.php');}
}
}