View Full Version : Displaying query results

06-21-2006, 03:59 PM

i have a javascript scrolling text function, for a news scroller on my site, the news headings are returned from a database.

I have a query which returns 8 different rows, is there anyway that i can print these results on screen, but in one row and not 8, without using any form of table.

i have the following:-



$query = "select * from monksc.news where id='26'";

$result = mysql_query ($query) or die (mysql_error());

if (mysql_num_rows($result)>0)




if ($title !== $row['title'])

print '<img src="../images/trans.gif" width="50" height="1">';


i think it's the code below which prints the results in rows, i need them in one.

<a class="ticker" href="news_item.php?id=<?php echo rawurlencode($row['id']);?>"><?php print $row['title']; $title = $row['title'];}}?>

any help would be great.

06-21-2006, 09:21 PM
you could do the following

put this in the while loop

$news_item .= '<a class="ticker" href="news_item.php?id=' . rawurlencode($row['id']) . '">' . $row['title'] . ' ';

then print out the $news_item variable after the while loop

06-22-2006, 09:03 AM
works a treat, thank you for your help.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum