Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/270.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在PHP查询结果中查找对象_Php_Joomla2.5 - Fatal编程技术网

在PHP查询结果中查找对象

在PHP查询结果中查找对象,php,joomla2.5,Php,Joomla2.5,我正在从Joomla 2.5中的自定义类别表加载值。这很好,我可以显示每个类别的名称 然后我想将具有特定id的类别添加到新数组中,但我无法使其正常工作。 在C#中,我确切地知道如何做到这一点,但在PHP中却不知道 以下是我的代码(thx用于修复代码格式): 根据joomla loadObjectList()返回如下数组: Array ( [0] => stdClass Object ( [id] => 1 [name] => John Smith [ema

我正在从Joomla 2.5中的自定义类别表加载值。这很好,我可以显示每个类别的名称

然后我想将具有特定id的类别添加到新数组中,但我无法使其正常工作。 在C#中,我确切地知道如何做到这一点,但在PHP中却不知道

以下是我的代码(thx用于修复代码格式):


根据joomla loadObjectList()返回如下数组:

Array ( 
    [0] => stdClass Object ( [id] => 1 [name] => John Smith 
    [email] => johnsmith@domain.example [username] => johnsmith ) 
    [1] => stdClass Object ( [id] => 2 [name] => Magda Hellman 
    [email] => magda_h@domain.example [username] => magdah ) 
    [2] => stdClass Object ( [id] => 3 [name] => Yvonne de Gaulle 
    [email] => ydg@domain.example [username] => ydegaulle ) 
)

那么试试
$cat->id
(小写字母I)

有什么问题<代码>$arr2是否仍为空?尝试了
$cat->id
(小写字母I)?在旁注中,您应该使用
#uuu
来定义表前缀,而不是
ind_u
,因此它将是
$query->from(“#uu类别”)
Array ( 
    [0] => stdClass Object ( [id] => 1 [name] => John Smith 
    [email] => johnsmith@domain.example [username] => johnsmith ) 
    [1] => stdClass Object ( [id] => 2 [name] => Magda Hellman 
    [email] => magda_h@domain.example [username] => magdah ) 
    [2] => stdClass Object ( [id] => 3 [name] => Yvonne de Gaulle 
    [email] => ydg@domain.example [username] => ydegaulle ) 
)