darkfreaks Posted February 7, 2008 Share Posted February 7, 2008 ok so my comments seem to be endlessly looping instead of showing just once? can anyone see why ??? <?php define('QUADODO_IN_SYSTEM', true); require_once('includes/header2.php'); include ('config.php'); $query=trim(mysql_real_escape_string($query)); $query = "SELECT * FROM vc_users WHERE username='$u'"; $result = mysql_query($query); $num=mysql_num_rows($result); mysql_close(); $i=0; while ($i < $num) { $logname = stripslashes($qls->user_info['username']); $header = mysql_result($result,$i,"header"); $group_id = mysql_result($result,$i,"group_id"); $dpic = mysql_result($result,$i,"dpic"); $privatecomments = mysql_result($result,$i,"privatecomments"); $invisible = mysql_result($result,$i,"invisible"); if ($group_id=="1") { ?> PLEASE DO NOT bother <?php echo $u; ?> with issues like:<br> reporting nudity (unless its a hot girl than report right away)<br> complaining about other users (This isnt VF)<br> any other site-related problems (We already know about the bugs)<br> ALL issues should be sent to:<br> <a href="../profile/admin">The Admin Profile</a> <p> <?php }; if ($group_id=="4") { ?> PLEASE DO NOT bother <?php echo $u; ?> with issues like:<br> reporting nudity (unless its a hot girl than report right away)<br> complaining about other users (This isnt VF)<br> any other site-related problems (We already know about the bugs)<br> ALL issues should be sent to:<br> <a href="../profile/admin">The Admin Profile</a> <p> <?php }; if ($u=="admin") { echo "PLEASE LEAVE YOUR REPORT BELOW AND WE WILL REPLY AS SOON AS POSSIBLE<br>"; }; ?> <form name="sendcomment" id="sendcomment" method="post" action="commentsleft.php"> Leave a comment for<br> <img src="gallery/<?php echo $dpic; ?>" border="0" class="thumbnail2"><br> <?php echo $u; ?> <br> <?php if ($invisible=="yes") { echo "[invisible]"; }; $users = $qls->online_users(); $online_count = count($users); $online = false; for ($x = 0; $x < $online_count; $x++) { if ($users[$x]['username'] == $u) { $online = true; break; } } if ($online === true) { echo "<font color='Lime'>[Online]</font>"; } else { echo "<font color='Red'>[Offline]</font>"; } ?> <br> <input type="hidden" name="date" id="date" value="<?php $date_time = date('l M d, Y g:i A'); echo ($date_time); ?>(GMT)"> <input type="hidden" name="username" id="username" value="<?php echo $u; ?>"><br> <input type="hidden" name="fname" id="fname" value="<?php echo $logname; ?>"><br> <textarea rows="10" cols="50" name="message"> <?php echo $message; ?> </textarea> <br> <?php if($username=="admin") { echo "<input type='hidden' name='inbox' value='yes'>"; }else{ ?> Send to Inbox? <input type="checkbox" name="inbox" value="yes" <?php if($reply=="1") { echo "checked"; }; ?>> <?php }; ?> <?php if ($group_id=="1") { if ($privatecomments=="yes") { echo " Make private? <input type=\"checkbox\" name=\"private\" id=\"private\" value=\"yes\">"; }else{ echo ""; }; }; if ($group_id=="3") { if ($privatecomments=="yes") { echo " Make private? <input type=\"checkbox\" name=\"private\" id=\"private\" value=\"yes\">"; }else{ echo ""; }; }; if ($group_id=="4") { if ($privatecomments=="yes") { echo " Make private? <input type=\"checkbox\" name=\"private\" id=\"private\" value=\"yes\">"; }else{ echo ""; }; }; if ($group_id=="5") { if ($privatecomments=="yes") { echo " Make private? <input type=\"checkbox\" name=\"private\" id=\"private\" value=\"yes\">"; }else{ echo ""; }; }; ?> <br> <input type="hidden" name="new" id="new" value="yes"><br> <input type="submit" id="submit" name="submit" value=" Send Message "> <br> </form> <?php $i++; include ('includes/footer.php'); ?> Link to comment https://forums.phpfreaks.com/topic/89955-solved-comments-looping/ Share on other sites More sharing options...
craygo Posted February 7, 2008 Share Posted February 7, 2008 you have to increment $i everytime it loops otherwise it stays at 0. at the end of the loop add $i++; $i=0; while ($i < $num) { $logname = stripslashes($qls->user_info['username']); $header = mysql_result($result,$i,"header"); $group_id = mysql_result($result,$i,"group_id"); $dpic = mysql_result($result,$i,"dpic"); $privatecomments = mysql_result($result,$i,"privatecomments"); $invisible = mysql_result($result,$i,"invisible"); if ($group_id=="1") { ?> PLEASE DO NOT bother <?php echo $u; ?> with issues like:<br> reporting nudity (unless its a hot girl than report right away)<br> complaining about other users (This isnt VF)<br> any other site-related problems (We already know about the bugs)<br> ALL issues should be sent to:<br> <a href="../profile/admin">The Admin Profile</a> <p> <?php $i++; }; Ray Link to comment https://forums.phpfreaks.com/topic/89955-solved-comments-looping/#findComment-461209 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.