rofl90 Posted March 9, 2008 Share Posted March 9, 2008 I have this testimonial grabber but it just keeps looping the same exact testimonial for infinite... <?php echo "<h1>Testimonials</h1>"; echo "<br />"; while($finalisedpage = mysql_fetch_array(mysql_query("SELECT * FROM testimonials"))) { echo $finalisedpage['clientname']; echo "<br /><blockquote>"; echo $finalisedpage['message']; echo "</blockquote><br />"; echo $finalisedpage['company']; echo "<br />"; echo date("jS \of F, Y.",$finalisedpage['date']); echo "<br /><br />"; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/95172-looping-for-infinite/ Share on other sites More sharing options...
laffin Posted March 9, 2008 Share Posted March 9, 2008 move mysql_query outside of the while conditional. u are getting the same row (row 1) because the query is being constantly run everytime the loop cycles. Quote Link to comment https://forums.phpfreaks.com/topic/95172-looping-for-infinite/#findComment-487468 Share on other sites More sharing options...
Stooney Posted March 9, 2008 Share Posted March 9, 2008 $result=mysql_query("SELECT * FROM testimonials"); while($finalisedpage = mysql_fetch_array($result)) { Quote Link to comment https://forums.phpfreaks.com/topic/95172-looping-for-infinite/#findComment-487483 Share on other sites More sharing options...
rofl90 Posted March 9, 2008 Author Share Posted March 9, 2008 Thankyou so much both of you Quote Link to comment https://forums.phpfreaks.com/topic/95172-looping-for-infinite/#findComment-487485 Share on other sites More sharing options...
roopurt18 Posted March 9, 2008 Share Posted March 9, 2008 echo date("jS \of F, Y.",$finalisedpage['date']); Suggestion: Look at the documentation for MySQL's DATE_FORMAT function. Quote Link to comment https://forums.phpfreaks.com/topic/95172-looping-for-infinite/#findComment-487529 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.