...

View Full Version : displaying a mysql records in marquee



mrjameer
01-02-2007, 03:23 PM
hi,

i have one mysql table called employee.its fields are as follows
id--name
1--abc
2---cbv
3--edr
.i want to display the all names from db in html marquee.when i try to print all values it prints only last value in marquee.how to do this.any of your help will be appreciated

thanks
mrjameer

Thompson
01-02-2007, 03:50 PM
Well, man.... this is happenning because, I think, that you're not looping correctly the variable that contains all the lines of your query.

How are you trying to print all the names of your table?

With the structure proposed by you and assuming that you already have made a mysql connection, you should try this:



$query = "SELECT name FROM employee ORDER BY name ASC";
$result = mysql_query($query);

while( $line = mysql_fetch_object($result) )
{
$body .= $line->name. ", ";
}

print "<marquee>". substr($body, -2) ."</marquee>";



I think this should help you.
:thumbsup:

mrjameer
01-02-2007, 03:59 PM
hi,


thanks a lot, it worked excellent

mrjameer



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum