Welcome Guest, Not a member yet? Register   Sign In
Using In_Array with Query Results
#1

[eluser]lightnb[/eluser]
How can I do this?

Code:
$this->db->select('ForumCategoryName, ForumCategoryType');
$Query = $this->db->get('Forums_Categories');
$ResultArray = $Query->result();

if(in_array($CategoryName, $ResultArray['ForumCategoryName']))
{
...

I want to see if "$CategoryName" is one of the "ForumCategoryName"s found by the query.
#2

[eluser]Référencement Google[/eluser]
You should first do a print_r($ResultArray) to see how CI return your result, you will see then that is is returned as an array of objects that you may use with a foreach loop.
You also can make CI return an pure array of results by using $query->result_array()




Theme © iAndrew 2016 - Forum software by © MyBB