ianhaney Posted February 16, 2019 Share Posted February 16, 2019 I have a blog on my website and the blogs content is stored in a database. On my home page I have the two recent articles displayed on my home page but I have to change them manually so I add the recent article on the home page in the first column and the second most recent one in the next column so they are side by side. What I want to do is automatically display the blogs image and blog title from the database and display on the home page so I don't have to keep changing it manually My current code looks like the following <div class="block"> <div class="container"> <h3 class="text-center"><span class="color">Recent Blog Articles</span></h3> <div class="row"> <div class="col-md-6"> <div class="text-img animation" data-animation="fadeInLeft" data-animation-delay="0.5s"> <a href="https://www.it-doneright.co.uk/blog/one-year-to-go-until-end-of-support-for-windows-7"> <div class="image"> <img class="img-responsive" src="https://www.it-doneright.co.uk/images/blog/windows7-eos-new.jpg" alt="One year to go until end of support for Windows 7"> </div> <p>One year to go until end of support for Windows 7</p> </a> </div> </div> <div class="col-md-6"> <div class="text-img animation" data-animation="fadeInLeft" data-animation-delay="0.5s"> <a href="https://www.it-doneright.co.uk/blog/windows-10-is-going-to-require-7gb-of-storage-for-future-updates"> <div class="image"> <img class="img-responsive" src="https://www.it-doneright.co.uk/images/windows-ten-updates-needing-7gb-space-on-hard-drive.jpg" alt="Windows 10 is going to require 7gb of storage for future updates"> </div> <p>Windows 10 is going to require 7gb of storage for future updates</p> </a> </div> </div> </div> </div> </div> I did look on Google before posting but could not get my head around how to do it, could anyone point me in the right direction or start me off and will have a go Quote Link to comment https://forums.phpfreaks.com/topic/308339-display-data-in-two-columns-bootstrap/ Share on other sites More sharing options...
mac_gyver Posted February 16, 2019 Share Posted February 16, 2019 before the start of your html document, query for and retrieve the data you want in the order that you want it, storing the two rows of data in an appropriately named php array variable. loop over the data at the point in your html document where you want to display the content and output the dynamic parts using php code. Quote Link to comment https://forums.phpfreaks.com/topic/308339-display-data-in-two-columns-bootstrap/#findComment-1564507 Share on other sites More sharing options...
Cobra23 Posted February 16, 2019 Share Posted February 16, 2019 Are you using Wordpress by any chance? I asked because you mentioned a blog Quote Link to comment https://forums.phpfreaks.com/topic/308339-display-data-in-two-columns-bootstrap/#findComment-1564508 Share on other sites More sharing options...
ianhaney Posted February 16, 2019 Author Share Posted February 16, 2019 Just now, Cobra23 said: Are you using Wordpress by any chance? I asked because you mentioned a blog No am not using Wordpress Quote Link to comment https://forums.phpfreaks.com/topic/308339-display-data-in-two-columns-bootstrap/#findComment-1564509 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.