Jump to content


Photo

Displaying Information in Columns


  • Please log in to reply
1 reply to this topic

#1 symrustar

symrustar
  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 25 April 2006 - 06:52 AM

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)

#2 wisewood

wisewood
  • Members
  • PipPipPip
  • Advanced Member
  • 226 posts
  • LocationRotherham, England

Posted 25 April 2006 - 09:20 AM

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

<?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
?>

wisewood: proven fact, I am both wise, and wooden.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users