php - While loop only retrieving one result -


update: still can't seem figure out. if can lend hand, appreciated ^^.

i having problem , i'm not sure code breaking down. have 'follow' function can follow different registered users. userid's of followed stored in array (follower_array). it's retrieving each member array, of each member that's followed instead of displaying content, it's displaying 1 latest 1 each member.

$broadcastlist= "";  if ( $follower_array != "" ) {    $followarray = explode(",", $follower_array);   $followcount = count($followarray);      $i = 0;   $broadcastlist .= "<table>";    foreach( $followarray $key => $value ) {      $i++;     $sqlname = mysql_query("         select username, fullname            members           id='$value'           limit 1     ") or die ("error!");      while ( $row = mysql_fetch_array($sqlname) ) {       $friendusername = substr($row["username"],0,12);     }      $sqlbroadcast = mysql_query("         select mem_id, bc, bc_date, device            broadcast           mem_id='$value'        order bc_date asc           limit 50     ") or die ("error!");      while ( $bc_row = mysql_fetch_array($sqlbroadcast) ) {       $mem_id  = $bc_row['mem_id'];       $bc      = $bc_row['bc'];       $dev     = $bc_row['device'];       $bc_date = $bc_row['bc_date'];       $broadcastlist .= "<td><a href='member.php?id=' .$value. ''>       $friendusername</a> &bull; $when_bc &bull; via: $dev <b>$bc</b></td></tr>";     }     broadcastlist .= "</table>";   } } 

so, it's retrieving members entirely, not more single latest "broadcast." insight appreciated.. thank you!

here's what's happening:

while( $row = some_next_result_function() ){     $result = $row["thing"]; } 

is going overwrite $result every time, you'll end last result.

you need make list , append instead.


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -