简体   繁体   English

在选框中显示mysql数据

[英]displaying mysql data in marquee

i want to make an news bar, by selecting mysql data and display it in and marquee, the problem that all the data are displayed at the same time in different lines, what i need is to display the data line by line. 我想制作一个新闻栏,通过选择mysql数据并将其显示在和选取框中,所有数据同时显示在不同行中的问题,我需要的是逐行显示数据。 code: 码:

$news = mysql_query("SELECT ann_title, ann_text FROM o_postnews_conference");
         while ($row = mysql_fetch_assoc($news)) {
             echo "<marquee style='float:bottom;'><font color='snow'>{$row['ann_title']}: {$row['ann_text']}</font></marquee>";

It's because you're creating a new marquee element every iteration of your while loop. 这是因为你在while循环的每次迭代中都在创建一个新的marquee元素。 Use something like the below code instead. 请改用以下代码。

$news = mysql_query("SELECT ann_title, ann_text FROM o_postnews_conference");
   echo "<marquee style='float:bottom;'><font color='snow'>";      
   while ($row = mysql_fetch_assoc($news))
             echo "{$row['ann_title']}: {$row['ann_text']} ";
   echo "</font></marquee>";

Although you should know that marquee has been deprecated and you should be using CSS3/javascript instead. 虽然你应该知道marquee已被弃用,你应该使用CSS3 / javascript代替。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM