i have a problem with array i have 2 table please check attachment

$sqlQuery=mysql_query("select * from tbl_page_detail where page_name='Home'");
	   $sqlArr=mysql_fetch_array($sqlQuery);
	   $arr = explode(",", $sqlArr['page_cat']);
	   $arrsize=count($arr);
	   $arrsizefloat=ceil($arrsize/2);
       for($i=1;$i<=$arrsizefloat;$i++){?>

            
                    <? for($f=1;$f<=$arrsize;$f++){
					  if($f%2){
					  		echo $val=$f-$i;

	

 $yahoo[]=$val;

						  } else {
							  $yahoon[]=$val;}
						  }
						 $comma_separated = implode(",", $yahoo);
}

i want to fetch category name from tbl_category table, but these category comes from tbl_page_detail in array form,

thanks in advance

Check this code..
let me know output.

<?
	$sqlQuery=mysql_query("select * from tbl_page_detail where page_name='Home'");
	$sqlArr=mysql_fetch_array($sqlQuery);
	$cat = $sqlArr['page_cat'];
	
	$sql = "select * from tbl_category where cat_id IN ($cat)";
	$res = mysql_query($sql);
	$str = '';
	while($sar = mysql_fetch_assoc($res))
	{
		$str.=','.$sar['cat_name'];
	}
	echo 'Category Names : '.$str;
?>

Hi I tried This one
Please Check it out
Code by Web Developer

$res=mysql_query("select page_cat from tbl_page_detail where page_name='Home'");
	$rs=mysql_fetch_array($res);
	$q="select * from tbl_category where cat_id IN (".$rs[0].")";
	$res=mysql_query($q);
	
	$arr=array();
	while($rs=mysql_fetch_array($res))
	{
		array_push($arr,$rs['cat_name']);
	}
	$arr1 = implode(",", $arr);
	echo $arr1;
Member Avatar for diafol

Any chance you can post full code, zip files are a big no-no for me unless I know the source.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.