I am trying to show a different icon on a page based on the category ID in the database. However, it keeps returning the last statement, and I do not recieve any error messages. What am I doing wrong?
$today_date = gmtime();
$new_days = 604800; # 7 days
$threshold = $today_date - $new_days;
$newlink = 0;
if($time > $threshold) {
$newlink = 1;
}
$result3 = mysql_query('SELECT cid, FROM prefix.'_categories' WHERE cid IS NOT Null');
$row = $db->sql_fetchrow($result3);
$cat_id = $result3;
if ($newlink == 1) {
$newlinkgraphic = ' <img src="themes/'.$CPG_SESS['theme'].'/images/wlpro/folders/folder_sub_new.png" alt="'._WLP_NEWLINK.'" />';
}
if ($cat_id == 1) {
return $newlinkgraphic = ' <img src="themes/'.$CPG_SESS['theme'].'/images/wlpro/folders/Invoicing_and_Billing.gif" alt="'._WLP_CATLAST7DAYS1.'" title="'._WLP_CATLAST7DAYS1.'" />';
}
if ($cat_id == 2) {
$newlinkgraphic = ' <img src="themes/'.$CPG_SESS['theme'].'/images/wlpro/folders/Accounting.gif" alt="'._WLP_CATLAST7DAYS2.'" title="'._WLP_CATLAST7DAYS2.'" />';
}
elseif($cat_id == 3) {
$newlinkgraphic = ' <img src="themes/'.$CPG_SESS['theme'].'/images/wlpro/folders/Billing_software, invoice software.gif" alt="'._WLP_CATLAST7DAYS3.'" title="'._WLP_CATLAST7DAYS3.'" />';
}
if ($cat_id == 4) {
$newlinkgraphic = ' <img src="themes/'.$CPG_SESS['theme'].'/images/wlpro/folders/Business_Help.gif" alt="'._WLP_CATLAST7DAYS4.'" title="'._WLP_CATLAST7DAYS4.'" />';
}
if ($cat_id == 5) {
$newlinkgraphic = ' <img src="themes/'.$CPG_SESS['theme'].'/images/wlpro/folders/Calling_and_Confrencing.gif" alt="'._WLP_CATLAST7DAYS5.'" title="'._WLP_CATLAST7DAYS5.'" />';
}
if($cat_id == 6) {
$newlinkgraphic = ' <img src="themes/'.$CPG_SESS['theme'].'/images/wlpro/folders/Communication.gif" alt="'._WLP_CATLAST7DAYS6.'" title="'._WLP_CATLAST7DAYS6.'" />';
}
if ($cat_id == 7) {
$newlinkgraphic = ' <img src="themes/'.$CPG_SESS['theme'].'/images/wlpro/folders/Courses_and_Lessons.gif" alt="'._WLP_CATLAST7DAYS7.'" title="'._WLP_CATLAST7DAYS7.'" />';
}
if ($cat_id == 8) {
$newlinkgraphic = ' <img src="themes/'.$CPG_SESS['theme'].'/images/wlpro/folders/CRM_Market_Research.gif" alt="'._WLP_CATLAST7DAYS8.'" title="'._WLP_CATLAST7DAYS8.'" />';
}
if ($cat_id == 9) {
$newlinkgraphic = ' <img src="themes/'.$CPG_SESS['theme'].'/images/wlpro/folders/Document_Management.gif" alt="'._WLP_CATLAST7DAYS9.'" title="'._WLP_CATLAST7DAYS9.'" />';
}
if($cat_id == 10) {
$newlinkgraphic = ' <img src="themes/'.$CPG_SESS['theme'].'/images/wlpro/folders/International_Travel.gif" alt="'._WLP_CATLAST7DAYS10.'" title="'._WLP_CATLAST7DAYS10.'" />';
}
if($cat_id == 11) {
$newlinkgraphic = ' <img src="themes/'.$CPG_SESS['theme'].'/images/wlpro/folders/Legal_Forms.gif" alt="'._WLP_CATLAST7DAYS11.'" title="'._WLP_CATLAST7DAYS11.'" />';
}
if($cat_id == 12) {
$newlinkgraphic = ' <img src="themes/'.$CPG_SESS['theme'].'/images/wlpro/folders/Legal_Tools.gif" alt="'._WLP_CATLAST7DAYS12.'" title="'._WLP_CATLAST7DAYS12.'" />';
}
if($cat_id == 13) {
$newlinkgraphic = ' <img src="themes/'.$CPG_SESS['theme'].'/images/wlpro/folders/Logistics.gif" alt="'._WLP_CATLAST7DAYS13.'" title="'._WLP_CATLAST7DAYS13.'" />';
}
if($cat_id == 14) {
$newlinkgraphic = ' <img src="themes/'.$CPG_SESS['theme'].'/images/wlpro/folders/Messaging.gif" alt="'._WLP_CATLAST7DAYS14.'" title="'._WLP_CATLAST7DAYS14.'" />';
}
if($cat_id == 15) {
$newlinkgraphic = ' <img src="themes/'.$CPG_SESS['theme'].'/images/wlpro/folders/Presentations.gif" alt="'._WLP_CATLAST7DAYS15.'" title="'._WLP_CATLAST7DAYS15.'" />';
}
if($cat_id == 16) {
$newlinkgraphic = ' <img src="themes/'.$CPG_SESS['theme'].'/images/wlpro/folders/Project_Management.gif" alt="'._WLP_CATLAST7DAYS16.'" title="'._WLP_CATLAST7DAYS16.'" />';
}
else {
$newlinkgraphic = ' <img src="themes/'.$CPG_SESS['theme'].'/images/wlpro/folders/folder_sub.png" alt="'._WLP_OLDLINK.'" />';
}
return $newlinkgraphic;