我正在尝试将数据放入from
:
[comments] => Array
(
[count] => 2
[data] => Array
(
[0] => Array
(
[idcomments] => 1
[from] => Array
(
[idusers] => 1
[username] =>
[full_name] => AndrewLiu
)
[text] => testing this comment out
)
[1] => Array
(
[idcomments] => 2
[from] => Array
(
[idusers] => 1
[username] =>
[full_name] => AndrewLiu
)
[text] => more comments yeah
)
)
)
我有这样的事情:
while($row = $SQL_products -> fetch(PDO::FETCH_ASSOC)){
$json['data'][] = array(
"comments" =>array(
"count"=>$SQL_ccount[0],
"data" => array($SQL_comments->fetchAll(PDO::FETCH_ASSOC),
"from" => array($SQL_comments_from->fetchAll(PDO::FETCH_ASSOC)))
),
);
}
但它不属于from
. 不知道像上面的例子那样正确$SQL_comments_from
的语法是什么。data
这就是我得到的
[comments] => Array
(
[count] => 2
[data] => Array
(
[0] => Array
(
[0] => Array
(
[idcomments] => 1
[from] => 1
[text] => testing this comment out
)
[1] => Array
(
[idcomments] => 2
[from] => 2
[text] => more comments yeah
)
)
[from] => Array
(
[0] => Array
(
[idusers] => 1
[username] =>
[full_name] => AndrewLiu
)
)
)
)
我正在尝试"from"
进入"data"
. 我提供的示例不会使“发件人”进入另一个“发件人”(就在 idcomments 下)
提前致谢!