如果在PHP上的Array中[关闭]

I have two result from MYSQL...

$table = $db->getPrefix().'content';
$query = mysql_query("SELECT catid FROM $table WHERE id = $id");
$result = mysql_fetch_assoc($query);
$catId = $result['catid'];

And...

$table_2 = $db->getPrefix().'categories';
$query_2 = mysql_query("SELECT id FROM $table_2 WHERE parent_id = 11");
while($result_2 = mysql_fetch_array($query_2)){
echo implode(',',$result_2);
}

I need a if like this...

if($catId = $result_2){
...
}

How can I solve?

I'm guessing you're trying to find out if $catId is in the $result_2 array. If so, then you've already answered your question with your title here.. in_array

if(in_array($catId,$result_2))