我有一个简单的函数checkReplies()
来检查reply_id
并且如果reply_id
不等于0
,则调用自己并再次检查。现在我需要为它生成的输出创建一个数组 f ,但我做不到,数组只输出最后一个元素
function checkReplies( $rnid ){
$r_notes = array();
include_once('include/class.dbc.php');
$dbo=new dbc();
$db=$dbo->dbconnect();
if( $rnid > 0 ):
$qry_rn = "SELECT note_subject,note_body,reply_note_id FROM tbl_notes WHERE note_id = '$rnid' ORDER BY note_date DESC";
$rslt_rn = $dbo->executeQuery( $qry_rn );
$reply = '<p style="border : none;">';
$reply .= $rslt_rn[0]['note_subject'].'<br />'.$rslt_rn[0]['note_body'];
$reply .= '('.$rslt_rn[0]['reply_note_id'].')';
$reply .= '</p>';
echo $reply;
$r_notes[] = $reply;
checkReplies( $rslt_rn[0]['reply_note_id'] );
endif;
return $r_notes;
}
$display = checkReplies( $rnid );
var_dump($display);
如何创建输出数组?