我有下面的代码显示正确的结果对我来说,但不幸的是我不能将这些结果传递到我的HTML页面并返回一定的值。面对数组的瓶颈
这是我的SQL语句:
$stmt = "SELECT * FROM "._CONST_TBL_EVENT_COMMENT." WHERE event_id = $record";
if($rs = $db->Execute($stmt))
{
while($rsa = $rs->FetchRow())
{
array_push($arrResult, array(
"id" => $record,
"name" => $alumni->getAlumniNameForEventComment($rsa['member_id']),
"file_path" => $alumni->getAlumniImageForEventComment($rsa['member_id']),
"content" => $rsa['text'],
"date" => $rsa['modified_timestamp']
));
}
}
这是结果我得到:
Array ([0] =>
Array ([id] => 1 [name] =>
Array ([0] => Array ([name] => alisdfsadf))
[file_path] =>Array ([0]=> Array ([file_path] => hydrangeas_23197.jpg))
[content] => test test test test
[date] => 2014-05-08 00:00:00)
[1] =>
Array ([id] => 1 [name] =>
Array ([0] => Array ([name] => billy))
[file_path] => Array ([0] => Array ([file_path] =>))
[content] => sdfasdfas test
[date] => 2014-05-22 00:00:00)
)
但我想这样我的结果显示:
Array ([0] => Array([id] => 1 [name] => alisdfsadf
[file_path] => hydrangeas_23197.jpg
[content] => test test test test
[date] => 2014-05-08 00:00:00)
如何我做这个?我希望有人能帮助我。先谢谢了。
为什么'getAlumniNameForEventComment'和'getAlumniImageForEventComment'返回数组而不是字符串? – Barmar