arrays - One character only is being returned when using foreach phpfox -
i trying data table when use foreach returns 1 character or 1st letter/number , 1 row returned.
here code. home.class.php
public function getdata() { $arow = $this->database()->select('*') ->from('tablename') ->execute('getslaverow'); return $arow; }
ajax.class.php
public function getarr() { $data = 'no data found'; $results = phpfox::getservice('files.home')->getdata(); if($results) { $data = '<div id="fileparse" style="height:295px;overflow:auto;display:none;"</div>'; $data .= '<div id="filelist" style="height:295px;overflow:auto;">'; $data .= '<table style="width:100%;"><tr><td><b>file name</b></td><td> <b>account type</b></td><td><b>account number</b></td><td><b>company</b></td><td><b>results</b></td></tr>'; foreach($results $result) { $data .= '<tr>'; $data .= '<td>'.$result['file'].'</td>'; $data .= '<td>'.$result['result'].'</td>'; $data .= '</tr>'; } $data .= '</table>'; $data .= '</div>'; } else $data = 'no results found'; $this->html('#eqblock', $data); }
use getslaverows insted of getslaverow
getslaverow return single array while getslaverows return rows
Comments
Post a Comment