Jump to content

display data in two columns bootstrap


ianhaney

Recommended Posts

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.