Can anybody see what I am doing wrong here? I am trying to include a certain page depending on the value of a field in database.
I have 2 tables to check,
if username appears in table.1 and field.units = days inlcude days.php
if username appears in table.1 and field.units = hours inlcude hours.php
if username appears in table.2 and field.units = days inlcude days.php
if username appears in table.2 and 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');}
}
}