sstangle73 Posted April 2, 2008 Share Posted April 2, 2008 Allright! So i have this script where it pulls data from one db and uses that data to pull from 2 more dbs. The problem is with one of the later dbs when i run that query the friends who dont have an image in the DB end up not showing up at all with or without a "no image" image. Without the query on the image db everything runs fine and the "no image" image is shown. heres pictures + code with query: <?php $i = 0; $queryfriends="SELECT * FROM friends WHERE ID = '$pID' && `Accepted`='1'"; $resultfriends=mysql_query($queryfriends) or die(mysql_error()); while($arrayfriends=mysql_fetch_array($resultfriends)){ $queryusers="SELECT * FROM users WHERE ID = '$arrayfriends[Friend_ID]'"; $resultusers=mysql_query($queryusers) or die(mysql_error()); while($arrayusers=mysql_fetch_array($resultusers)){ $queryimages = "SELECT * FROM image WHERE ID = '$arrayfriends[Friend_ID]' && `Default` = '1'"; $resultimages = mysql_query($queryimages) or die(mysql_error()); while($arrayimages=mysql_fetch_array($resultimages)){ $URL = $arrayimages['URL']; if($resultfriends && mysql_num_rows($resultfriends) > 0){ $max_columns = 3; if($i == 0){ echo "<tr>"; } echo "<td><a href=\"" . $arrayfriends[Friend_ID] . "\">"; if(empty($URL)){ echo "<img src=\"http://x.myspace.com/images/no_pic.gif\" width=\"90px\" height=\"100px\" border=\"0\">"; }else{ echo "<img src=\"" . $URL . "\" width=\"90px\" height=\"100px\" border=\"0\">";} echo "</a><br>"; echo "<a href=\"" . $arrayfriends[Friend_ID] . "\"><b>" . $arrayusers[dname] . "</b></a>"; echo "</td>"; $i ++; if($i == $max_columns){ echo "</tr>"; $i = 0; } } } } } if($i < $max_columns){ for($j=$i; $j<$max_columns;$j++) echo "<td> </td>"; } ?> w/o: <?php $i = 0; $queryfriends="SELECT * FROM friends WHERE ID = '$pID' && `Accepted`='1'"; $resultfriends=mysql_query($queryfriends) or die(mysql_error()); while($arrayfriends=mysql_fetch_array($resultfriends)){ $queryusers="SELECT * FROM users WHERE ID = '$arrayfriends[Friend_ID]'"; $resultusers=mysql_query($queryusers) or die(mysql_error()); while($arrayusers=mysql_fetch_array($resultusers)){ // $queryimages = "SELECT * FROM image WHERE ID = '$arrayfriends[Friend_ID]' && `Default` = '1'"; // $resultimages = mysql_query($queryimages) or die(mysql_error()); // while($arrayimages=mysql_fetch_array($resultimages)){ $URL = $arrayimages['URL']; if($resultfriends && mysql_num_rows($resultfriends) > 0){ $max_columns = 3; if($i == 0){ echo "<tr>"; } echo "<td><a href=\"" . $arrayfriends[Friend_ID] . "\">"; if(empty($URL)){ echo "<img src=\"http://x.myspace.com/images/no_pic.gif\" width=\"90px\" height=\"100px\" border=\"0\">"; }else{ echo "<img src=\"" . $URL . "\" width=\"90px\" height=\"100px\" border=\"0\">";} echo "</a><br>"; echo "<a href=\"" . $arrayfriends[Friend_ID] . "\"><b>" . $arrayusers[dname] . "</b></a>"; echo "</td>"; $i ++; if($i == $max_columns){ echo "</tr>"; $i = 0; } } // } } } if($i < $max_columns){ for($j=$i; $j<$max_columns;$j++) echo "<td> </td>"; } ?> Thanks For The Help! Quote Link to comment https://forums.phpfreaks.com/topic/99109-displaying-some-data/ Share on other sites More sharing options...
sequalit Posted April 2, 2008 Share Posted April 2, 2008 why do you have a while loop for the images? Quote Link to comment https://forums.phpfreaks.com/topic/99109-displaying-some-data/#findComment-507090 Share on other sites More sharing options...
sstangle73 Posted April 2, 2008 Author Share Posted April 2, 2008 hah ahahhahahahaha all that time debugging for that simple word sigh thanks solved Quote Link to comment https://forums.phpfreaks.com/topic/99109-displaying-some-data/#findComment-507093 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.