Jump to content

[SOLVED]array() problem


darkcarnival

Recommended Posts

okay..i am assuming you are trying to do something like this (since you (still) haven't shown you're code):

[code]
$board_vars = array($board_id, $board_name, $board_description);
foreach ($board_vars as $val) {
  echo $val;
}
[/code]

is that about what you're code looks like? Then do this:

[code]
$board_vars = array($board_id, $board_name, $board_description);
foreach ($board_vars as $val) {
  echo "$val </br>";
}
[/code]

I'm not tryin' to be rude or nothin'. You just need to show your code if you expect people to accurately help with the problem. 

P.s. - I still insist that it is not a php but an html problem.  Unless you have some conditions or something that prevents your (tried) html code from being output: but again, show some code.
Link to comment
Share on other sites

i did show you the code ;)

[code]while($row = mysql_fetch_assoc ($board_query)){
$board_id .= $row['id'];
$board_name .= $row['Board'];
$board_description .= $row['Description'];
}
$board_vars = array($board_id, $board_name, $board_description);[/code]

that is what the function does ;)

now adding a br tag will just make the output worse.

example of it is:

<a href="link.php?id=1(newline)2(newline)3(newline)">link1(newline)link2(newline)link3(newline)</a>

it all should be it's own link, which is my present issue.

the full code is too lengthy to post here so im only posting the code thats causing the problem.
Link to comment
Share on other sites

If you want each row to createe a separate link then your whole while loop is wrong. It should be like this:

[code]while($row = mysql_fetch_assoc ($board_query)){
$board_id = $row['id'];
$board_name = $row['Board'];
$board_description = $row['Description'];

echo '<a href="link.php?id=' . $board_id . '">' . $board_name . '</a><br />';
echo '<span style="font-size: small">' . $board_description . '</span><br /><br />';

}[/code]

That should now print out a link for each board with its description.
Link to comment
Share on other sites

it is a html problem if you print it like
[code]
$board_vars = array($board_id, $board_name, $board_description);
[/code]
its obviously going to come out in one line as theres nothing showing it has to print onto the next line.
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • 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.