thara Posted June 30, 2015 Share Posted June 30, 2015 I am trying to display some images dynamically from a mysql table. This is what I tried it with PHP and its working for me. // Fetch all the records: while ($stmt->fetch()) { $html = " <div class='row-fluid custom'>\n"; $html .= " <div class='span6'>\n"; $html .= " <img src='images/{$image}'>\n"; $html .= " </div>\n"; $html .= " </div>\n"; //Add images to array $images[] = $html; } And this is the markup from about PHP: <div class='row-fluid custom'> <div class='span6'> <img src='images/cond-1.png'> </div> </div> <div class='row-fluid custom'> <div class='span6'> <img src='images/cond-2.png'> </div> </div> <div class='row-fluid custom'> <div class='span6'> <img src='images/cond-3.png'> </div> </div> <div class='row-fluid custom'> <div class='span6'> <img src='images/cond-4.png'> </div> </div> But my problem is, now I need to modify above Markup to like this. <div class="row-fluid custom"> <div class="span6"> <img src="images/cond-1.png"> </div> <div class="span6"> <img src="images/cond-2.png"> </div> </div> <div class="row-fluid custom"> <div class="span6"> <img src="images/cond-3.png"> </div> <div class="span6"> <img src="images/cond-4.png"> </div> </div> Can anybody tell me how I create like that markup using php?Hope somebody may help me out.Thank you. Quote Link to comment https://forums.phpfreaks.com/topic/297122-how-i-modify-this-php-while-loop/ Share on other sites More sharing options...
Ch0cu3r Posted June 30, 2015 Share Posted June 30, 2015 Have a look at this thread http://forums.phpfreaks.com/topic/11572-multi-column-results/ Quote Link to comment https://forums.phpfreaks.com/topic/297122-how-i-modify-this-php-while-loop/#findComment-1515294 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.