virak Posted July 21, 2009 Share Posted July 21, 2009 Dear all,I really got stuck with the php code.I want to appear "new" in which Category that emplyee just do a job posted.example: - Accountant(1) - IT and Telecom(3) - Audit(2)"new"after emplyee posted into Audit category it's will appear "new" for 3days.Anyone can help me please.your help is really appriciated.Hear is the code: <?php$SYSTEM_CATEGORIES_LIST="";$arrCategories = explode("\n", $strJobCategories);$SYSTEM_CATEGORIES_LIST.="<table width='91%' style='margin-bottom:2px;margin-top:0px;margin-left:8px;margin-right:8px'>";$iCounter = 0;$arrJobCount = array();$tablePosting=DataTable_Query("SELECT count(*) a, job_category FROM ".$DBprefix."ext_postings,".$DBprefix."ext_employers WHERE".$DBprefix."ext_postings.employer = ".$DBprefix."ext_employers.usernameAND expires>".time()." AND ".$DBprefix."ext_postings.active='YES'group by job_category");while($arrPosting = mysql_fetch_array($tablePosting)){ $strCat = explode("-",$arrPosting["job_category"]); if(!isset($arrJobCount[$strCat[0]])) { $arrJobCount[$strCat[0]]=0; } $arrJobCount[$strCat[0]] += $arrPosting["a"];}foreach($arrCategories as $strCategory){ $arrCategoryItems = explode(".",$strCategory,2); if(strstr($arrCategoryItems[0],"-")) { continue; } if($iCounter%$NUMBER_OF_JOB_CATEGORIES_PER_ROW==0) { $SYSTEM_CATEGORIES_LIST.="<tr>\n"; } $SYSTEM_CATEGORIES_LIST.="<td width=\"".round(100/$NUMBER_OF_JOB_CATEGORIES_PER_ROW,2)."%\">\n"; $strLink = ""; if($USE_MOD_REWRITE) { $strLink = "http://www.".$DOMAIN_NAME."/category/".$arrCategoryItems[0]."/".format_str($arrCategoryItems[1]).".html"; } else { $strLink = "index.php?mod=search&category=".$arrCategoryItems[0]; } $SYSTEM_CATEGORIES_LIST.="\n<a href=\"".$strLink."\" class=\"category_link\">".trim($arrCategoryItems[1])."</a> <a href=\"#\" style=\"text-decoration:none;\">(".(isset($arrJobCount[$arrCategoryItems[0]])?$arrJobCount[$arrCategoryItems[0]]:0).")</a>"; $SYSTEM_CATEGORIES_LIST.="</td>\n"; if(($iCounter+1)%$NUMBER_OF_JOB_CATEGORIES_PER_ROW==0) { $SYSTEM_CATEGORIES_LIST.="</tr>\n"; } $iCounter ++;}$SYSTEM_CATEGORIES_LIST.="</table>";?> Thanks & Regards,Virak Link to comment Share on other sites More sharing options...
justsomeguy Posted July 21, 2009 Share Posted July 21, 2009 If you have a date attached to each item in the database then you can send a query to count the number of items in a certain category that are less than 3 days old. The syntax will depend on how you're storing the date in the database. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.