Jump to content

Displaying results horizontally instead of vertically.


Recommended Posts

Firstly the PHP Code

[code]


<table class='tablefull' >

<?php

$hotmain=mysql_query("select * from mos_content ORDER BY 'mainhot' DESC LIMIT 2 ") or die(mysql_error());
while ($donnee = mysql_fetch_array($hotmain))
{ $title= $donnee['title'];  
$introtext=$donnee['introtext'];
$author=$donnee['created_by'];
$sectionid=$donnee['sectionid'];
$displayhot=$donnee['displayhot'];
$mainhot=$donnee['mainhot'];
$mainhot_img=$donnee['mainhot_img'];

if ($mainhot==1)

{

echo "<tr><td id='maintitle'> EXCLUSIVE </td></tr>";
echo " <tr><td id='image'> <center> <a href='http://www.pspcave.com/'> <img src='$mainhot_img'></a></center></td></tr>";

echo "<tr><td id='articletitle'><center><a href='http://www.pspcave.com/'>";

echo $title;

echo "</a></center></td></tr>";

}

}

?>

</table>

[/code]


Ok so now the problem. This code manages to display 2 x the result since i set the Limit to 2. But it displays it one on top of each other, vertically.

Like

[result1]
[result2]

But i want it to display it horizontally, side by side

like
[result1] [result2]
I know the <td> and <tr> tags should be changed. but i have been sitting around messing around with them but have no idea how to do it to display correct.

Regards
Check out the Code Snippet forum here ->

[url=http://www.phpfreaks.com/forums/index.php/topic,95426.0.html]http://www.phpfreaks.com/forums/index.php/topic,95426.0.html[/url]

It explains how to do multicolumn displays.
OK, so that code wasn't hard at all... My bad.

I was thinking of something completely different.  Multiple columns but still with results going vertically, like this:

[code]
|---|---|
| 1 | 4 |
|---|---|
| 2 | 5 |
|---|---|
| 3 | 6 |
|---|---|
[/code]

Over complicating things again :)

Huggie
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.