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 />"; } ?> 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. 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)) { 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 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. Link to comment https://forums.phpfreaks.com/topic/95172-looping-for-infinite/#findComment-487529 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.