Home > Backend Development > PHP Tutorial > ecshop getAll 的数组内容为什么打印不出?

ecshop getAll 的数组内容为什么打印不出?

WBOY
Release: 2016-06-23 13:16:16
Original
1334 people have browsed it

$sql = "SELECT user_id, content FROM ".$GLOBALS['ecs']->table('reg_extend_info')." WHERE content = '$filter[tuijianren]'";
$row = $GLOBALS['db']->getAll($sql);
$ex_where .= " AND user_id in ('$row[user_id]')";


print_r("

");   <br>print_r($row['user_id']);   <br>print_r("
Copy after login
");
die();

我是基于ecshop开发的,为什么这里的getAll查询的表字段读取不出?而print_r($row);就有内容,或者将getAll改成getRow的话print_r($row['user_id'])正常,print_r($row)也正常。

我想获取$row['user_id']的所有值,也就是查询推荐人名下的会员,请问应该怎么改呢?
给100分,谢谢!


回复讨论(解决方案)

$row 是二维数组,你当一维数组处理,当然不行

print_r($row); 是什么结果

$row 是二维数组,需要这样输出

foreach($row as $k=>$v){  echo $v['user_id'].'<br>';}
Copy after login

print_r($row); 是什么结果


打印出来是
Array
(
    [0] => Array
        (
            [user_id] => 55
            [content] => A923168
        )

    [1] => Array
        (
            [user_id] => 56
            [content] => A923168
        )

    [2] => Array
        (
            [user_id] => 60
            [content] => A923168
        )

    [3] => Array
        (
            [user_id] => 63
            [content] => A923168
        )

)

print_r($row[0]['user_id']);

新人 前来学习 

问题解决了,感谢回帖的各位,已经给分,谢谢

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template