Jump to content

Displaying Information in Columns


symrustar

Recommended Posts

Hello! I am a complete PHP virgin, and yet have still managed to create a website using PHP, MySQL, and e_107. The site works beautifully, but I have one issue in which in the member profiles section I have added in some more extented user fields. The problem is that it displays all the extended user fields in one vertical column like this...

1
2
3
4
5
6


And I would like the information to be displayed like this....

1 2
3 4
5 6

Do you guys have any idea of how/where to do this or maybe be able to point me in the right direction? All help greatly appreciated. Oh and please remember that I have no knowledge really of PHP so please in your answers talk to me like I'm 2yrs old so that I can understand it. I get lost in the lingo quite easily (prolly why alot of tutorials, and other help sites haven't helped much)

Edit**

[a href=\"http://darkseed.da.funpic.org/\" target=\"_blank\"]http://darkseed.da.funpic.org/[/a] <-- link to my site if it will help at all

[a href=\"http://deathfromabove.de.funpic.org/\" target=\"_blank\"]http://deathfromabove.de.funpic.org/[/a] <-- link to a site that has exact example of how i would like the info to be displayed... to get to it click on the 'Member Bios' link on the left hand side... then in the main display area click on any of the user names that are there and the example is the "Job Levels" section of the info that is displayed. (Hope this makes sense/helps)
Link to comment
Share on other sites

Change "$x%2" to show a number for how many columns you want to be displayed.

eg.
$x%2
1 2
3 4
5 6

$x%3
1 2 3
4 5 6

$x%4
1 2 3 4
5 6

[code]
<?php
$query= "SELECT * FROM your_table";
$result = MYSQL_QUERY($query);
$num = mysql_Numrows($result);

if ($num==0) {
    echo "No Results Found !";
}
else if ($num>0) {
$x=0;
?>
<table class="content" align="center">
<?
while ($x<$num)
      {
           if (($x%2)==0) { $row="</tr><tr><td class=report>"; } else { $row="<td>"; }
            $whatever_variable = mysql_result($result,$x,"whatever_field");

?>

<? echo $row ?>

<td class="report">

<?=$whatever_variable?>

</td>

<?
        $x++;
    } // end while
} // end if numberall > 0
?>
[/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.