473,609 Members | 2,173 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Display blogs in mulitple columns.

19 New Member
Below is a code which gets blogs from database and displays it in single column on screen, I want to display blogs in multiple columns may be three,with each column displaying 10 blogs ordered by their id, so how to do that. If it is too long to answer here maybe mentioning any method that is easy to use can help me.

this is how I call posts from db:

Expand|Select|Wrap|Line Numbers
  1.  $query = ("SELECT blogs_id, title, body, posted_by,  category FROM blogs INNER JOIN 
  2.     categories ON categories.category_id=blogs.category_id ORDER BY blogs_id desc LIMIT 10");
  3.     foreach($db->query($query)as $row){
  4.     $blogs_id = $row['blogs_id'];
  5.     $title = $row['title'];
  6.     $body = $row['body']; 
  7.     $posted_by = $row['posted_by']; 
  8.     $full_name = $row['full_name'];  
  9.     }
  10.  
  11.     $get_user = $db->prepare("SELECT * FROM userss WHERE username= :username");
  12.     $get_user->execute(array(':username'=>$posted_by)); 
  13.     $get_row = $get_user->fetch(PDO::FETCH_ASSOC);
  14.  
  15.     $profilephoto = $get_row['profile_photo'];
  16.       if ($profilephoto_ == "") {
  17.          $profilephoto = "./img/avatar_pic.png";
  18.       }
  19.       else {
  20.          $profilephoto = "./userdata/profile_photos/".$profilephoto_info;
  21.       }
  22.  
  23.       echo "<h2>$title</h2>
  24.           <p>$body</p>
  25.          <img src='$profilephoto' height='60'><br />
  26.             By:<a href='$posted_by'>$full_name</a>"; 
Oct 11 '15 #1
0 943

Sign in to post your reply or Sign up for a free account.

Similar topics

32
4137
by: Rich | last post by:
I'm sure it sounds kinda nutty to display 200 columns and 500,000 rows of data. But I have been pulling data from a Lotus Notes database into Sql Server for a while now, but Lotus Notes is starting to crack, columns getting corrupted. Can't handle the volume of data and number of columns. Sql Server has no problem. But displaying the data is the big deal. The end users want to be able to scroll acros a page to the colum of their...
2
2608
by: mary | last post by:
I need to display 10 fields (columns) to display in a crystal Report. When I am trying to print the report some of the columns are cutting off from the report. Is there any way to display the report horizontally. I am using Crystal Report 9. Please some body help me Thanks mary
2
3376
by: Ross Hamilton | last post by:
Can anyone help me with this small problem. I have a report that is divided into 3 Columns using the page setup, It displays the report fields in 3 separate columns (Desc & Pg Num) but it only displays the Page Header on the first column. Any thoughts?? regards,
3
2536
by: Diego TERCERO | last post by:
Hi... I'm working on a tool for editing text resources for a family of software product my company produces. These text resources are found in a SQL Server database, in a table called "Resource" with the following structure : Resource{,en,fr,es} Yes.. these are the only languages supported actually. A couple of rows in that table would look like this :
2
1998
by: Erik Cruz | last post by:
Hi. I have a repeater control bound to an ArrayList. When displaying the data, I need to show 3 columns per row, each column being one entry of my ArrayList, but the repeater understands that each record is a new line. Using ItemTemplate and AlternateItemTemplate I could display two columns but I need another one. How can I display records on columns instead of rows using the repeater control? TIA,
1
1298
by: Kiran A K | last post by:
Hi, I have a web service that returns a DataSet object. Now i want to write a client app that consumes this web service. In my client, i want to display the rows and columns of the DataSet object in a table control. Is there any table control available in VS.NET 2003? I didn't find any table control in the toolbox. Regards,
0
1446
by: Greg Collins [Microsoft MVP] | last post by:
I have written and posted the following articles which will prove useful to some: Display Lists in Columns Horizontally Using One Cell per Column http://www.braintrove.com/default.aspx?p=3&s=1&i=34 Display Lists in Columns Horizontally Using Individual Cells http://www.braintrove.com/default.aspx?p=3&s=1&i=33 Display Lists in Columns Vertically Using One Cells per Column http://www.braintrove.com/default.aspx?p=3&s=1&i=32
1
1004
by: =?Utf-8?B?bmlr?= | last post by:
I recently noticed that all folders across my computer (XP SP2) now include the artist, album title, track no. and year columns, as if the folder contains music. I don't want to have to go through every folder in my PC and remove those columns manually. How can I get rid of them across the board? Why does Windows Explorer think that if a folder is defined as containing video, for instance, it should nonetheless have the artist, album...
5
1889
by: rui dias | last post by:
Hello, I have a (big) table which is not normalized, but for i need at the moment i think that's no problem. Indeed, what i would like to do is to select the name field and the note. The problem is that i want to display the note in 2 different columns. the first columns will show the number (count) of time that a certain
0
8534
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8188
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8374
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6969
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6034
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5502
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4059
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2502
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
1366
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.