Jump to content

Archived

This topic is now archived and is closed to further replies.

blade_922

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

Share this post


Link to post
Share on other sites
It's possible, but not very easy.

I think I have some code somewhere I picked up recently that does it.

I'll look and post if I find it.

Huggie

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

×

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.