sstangle73 Posted March 31, 2008 Share Posted March 31, 2008 hey everyone i am tring to full a friends list from one db then use the lists of friends to get their picture and their display name but the script seems to only run one time anyone know why? <table cellspacing="3" cellpadding="3"> <?php $query56="SELECT * FROM friends WHERE ID = '$pID' && `Accepted`='1'"; $result56=mysql_query($query56) or die(mysql_error()); while($array56=mysql_fetch_array($result56)){ $query6 = "SELECT * FROM image WHERE ID = '$array56[Friend_ID]' && `Default` = '1'"; $result6 = mysql_query($query6) or die("There was a problem with the SQL query: " . mysql_error()); if($result6 && mysql_num_rows($result6) > 0){ $i= 0; $max_columns= 3; while($row = mysql_fetch_array($result6)){ $URL = $row['URL']; if('$URL' == '$row[\'URL\']'){ $URL = 'http://x.myspace.com/images/no_pic.gif'; } $query561="SELECT * FROM users WHERE ID = '$array56[Friend_ID]'"; $result561=mysql_query($query561) or die(mysql_error()); while($array561=mysql_fetch_assoc($result561)){ $fdname = $array561['dname']; // make the variables easy to deal with // open row if counter is zero if($i == 0){ echo "<tr>"; } echo "<td><table><tr><td><a href=\"" . $array56[Friend_ID] . "\"><img src=" . $URL . " width=\"90px\" height=\"100px\" border=\"0\"></a></td></tr>"; echo "<tr><td><center><a href=\"" . $array56[Friend_ID] . "\"><b>" . $fdname . "</b></a></center></td></tr></table></td>"; // increment counter - if counter = max columns, reset counter and close row if(++$i == $max_columns){ echo "</tr>"; $i=0; } // end if } } } // end while } // end if results // clean up table - makes your code valid! if($i < $max_columns) { for($j=$i; $j<$max_columns;$j++) echo "<td> </td>"; } ?> </tr> </table> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.