mrjameer Posted January 2, 2007 Share Posted January 2, 2007 hi,i have one mysql table called employee.its fields are as followsid--name1--abc2---cbv3--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 appreciatedthanksmrjameer Quote Link to comment https://forums.phpfreaks.com/topic/32568-displaying-records-in-marquee/ Share on other sites More sharing options...
kenrbnsn Posted January 2, 2007 Share Posted January 2, 2007 Please post you code surrounded by [nobbc][code][/code][/nobbc] tags.Ken Quote Link to comment https://forums.phpfreaks.com/topic/32568-displaying-records-in-marquee/#findComment-151414 Share on other sites More sharing options...
wildteen88 Posted January 2, 2007 Share Posted January 2, 2007 Get all the names in an array when you get them out of the database then use the implode function to convert them in to one big string, example:[code=php:0]// connect to mysql here// the query:// select all the names from the employee table$qry = "SELECT name FROM employee";$result = mysql_query($qry);// put the names into an arraywhile($row = mysql_fetch_assoc($result)){ // our array will be called names $names[] = $row['name'];}// now we implode the array into a string:// format will be the following:// name1, names2, name3, namex$namesList = implode(', ', $names);// print the HTML marquee:echo <<<HTML<marquee behavior="scroll">Our employee's: {$nameList}</marquee>HTML;[/code] Quote Link to comment https://forums.phpfreaks.com/topic/32568-displaying-records-in-marquee/#findComment-151417 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.