Jump to content


Photo

Simple Question!


  • Please log in to reply
3 replies to this topic

#1 downfall

downfall
  • Members
  • PipPipPip
  • Advanced Member
  • 61 posts

Posted 08 October 2006 - 07:18 PM

Hi,

At the moment, when my webpage retrives data from the database, the results list themselves side by side, like this:

T-Shirts Posters Calenders

As this is for the navigation, I need them to be listed downwards, like this:

T-Shirts
Posters
Calenders

Can anyone tell me how to do this?

This is my code for the php I'm inserting:

<?
					
					
$sql = "SELECT category_id, category_name
        FROM categories
        ORDER BY category_name";
$res = mysql_query($sql) or die(mysql_error());
while (list($id, $cat) = mysql_fetch_row($res)) {
    echo "<a href='details2.php?id=$id'>$cat</a>\n";
}

echo <<<_HTML

$list

_HTML;
								
?>


#2 Oldiesmann

Oldiesmann
  • Members
  • PipPipPip
  • Advanced Member
  • 72 posts
  • LocationCincinnati, Ohio

Posted 08 October 2006 - 07:29 PM

Replace the \n with <br /> and it should work.
The Oldiesmann
SMF Project Manager
SMF+Gallery2 - Beta3.1 now available

#3 AliasXNeo

AliasXNeo
  • Members
  • PipPip
  • Member
  • 11 posts

Posted 08 October 2006 - 07:32 PM

\n will only create a new line in the sense of source. If you look at the source of your page you will see that T-Shirts Posters Calenders are all on a different line. To visually see this line you must use HTML, AKA </br /> :P

#4 downfall

downfall
  • Members
  • PipPipPip
  • Advanced Member
  • 61 posts

Posted 08 October 2006 - 07:35 PM

Thanks for the quick replies, I used <br/> and works great!




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users