error in running recursion
<p>if running function returns server misconfiguration error</p>

<pre><code>    function build_path($cid)
    {
        $result = array();
        $DB = new MySQLTable;
        $DB-&gt;TblName = 'shop_categories';
        $where['cat_id']['='] = $DB-&gt;CleanQuest($cid);
        $res = $DB-&gt;Select('cat_id,cat_name,cat_parent', $where);
        if($res !== 'false')
        {
            $pid = mysql_fetch_array($res);
            if($pid['cat_parent'] !== 0)
            {
                Echo $pid['cat_parent'];
                build_path($pid['cat_parent']);
            } else {
                Echo $pid['cat_id'];
                return true;
            }
        }
        return false;
    }
</code></pre>

<p>I can't find an error here. Please help.</p>

<p>Sorry for disturbing you all. The trouble was in comparison 'if($pid['cat_parent'] !== 0)': $pid['cat_parent'] was a string with int(0)</p>

<p>Can i build this function to store full path without using GLOBALS and SESSION vars?</p>
