php mysqli only returns one row -


this code returns 1 row, should return 2 rows. have tried sql in php myadmin , returned 2 rows. doing wrong here?

$request_list_result = $mysqli->query(" select buddy_requester_id, buddy_reciepient_id, user_id, user_fullname sb_buddies join sb_users on buddy_requester_id=user_id buddy_status='0' , buddy_reciepient_id='". get_uid() ."'");  $request_list_row = $request_list_result->fetch_array();  echo $request_list['user_fullname']; 

btw, code above getting process profile.php via following script:

$index = new template('views/template/one.php', array( 'subtitle' => 'dashboard', 'stylesheets' => array('/assets/css/profile.css'), 'scripts' => array('/assets/js/dashboard.js'), 'sidebar' => 'sidebar.php', 'content' => 'views/profile.php', 'errors' => $errors, 'successes' => $successes, 'request_list' => $request_list_row //right here ), true); 

you need loop through results (as thesmose mentioned)

while ($request_list_row = $request_list_result->fetch_array()) {     echo $request_list['user_fullname']; } 

and need send resulting array $request_list template rather $request_list_row.

change this

'request_list' => $request_list_row //right here 

to this

'request_list' => $request_list //right here 

if want more user_fullname in template (and don't have php >= 5.3 required mysqli_result::fetch_all), need build own array inside loop.

i don't know template code expects, try

while ($request_list_row = $request_list_result->fetch_array()) {     echo $request_list[] = $request_list_row; } 

Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -