Jump to content

returning values in a <marquee> tag


sjones

Recommended Posts

Hello, I'm trying to return titles of events and scroll them in a <marquee> tag -but they are stacked on top of each other. Is there a way to have them one after another. Below is the code I am using.

 

<? include 'connections/mysql_connect.php';

            $sql = 'SELECT * FROM `events` ORDER BY `date_created` LIMIT 0, 30';

            $result = mysql_query($sql);

            while ($record = mysql_fetch_assoc($result)){

          $text = $record['title'];

  echo "<marquee scrolldelay='160' width='594' direction='left'><span class='default'><a href='news.php'>" .$record['title']. "</a></span></marquee>";

  ?>

Link to comment
https://forums.phpfreaks.com/topic/82943-returning-values-in-a-tag/
Share on other sites

You would need to either put lots of spaces inbetween with somthing like this...

 

Remember to try and use full PHP tags e.g. <?php instead of <?

 

<?php   include 'connections/mysql_connect.php';
            $sql = 'SELECT * FROM `events` ORDER BY `date_created` LIMIT 0, 30';
            $result = mysql_query($sql);
            while ($record = mysql_fetch_assoc($result)){
              $text .= $record['title'].'                                                  ';
            }        
            echo "<marquee scrolldelay='160' width='594' direction='left'><span class='default'><a href='news.php'>" .$text. "[/url]</span></marquee>"; 
   ?>

 

do you want just 1 url? or this to be chanbged reflecting the item?

 

Regards

Liam

O.K so I have changed it to this

 

<marquee scrolldelay="160" width="594" direction="left">

<?php  include 'connections/mysql_connect.php';

            $sql = 'SELECT * FROM `events` ORDER BY `date_created` LIMIT 0, 30';

            $result = mysql_query($sql);

            while ($record = mysql_fetch_assoc($result)){

              $text .= $record['title'].'       ';

            }

echo "<span class='default'>" .$text. " </span>";

?>

</marquee>

____________________________________________________________________

This ia returning the titles in one line. Now I have to work on the <a href> tag that will pull the URL for the article that goes with the headline that was returned. Will what I have below work? - using the $url

 

<marquee scrolldelay="160" width="594" direction="left">

  <?php  include 'connections/mysql_connect.php';

            $sql = 'SELECT * FROM `events` ORDER BY `date_created` LIMIT 0, 30';

            $result = mysql_query($sql);

            while ($record = mysql_fetch_assoc($result)){

              $url = $record['url'];

              $text .= $record['title'].'       ';

            }

echo "<span class='default'><a href=".$url.">" .$text. "</a> </span>";

    ?>

</marquee>

O.K I have solved it - This returns the the title and the URL - hopefully helpfull for the archive

 

<marquee scrolldelay="160" width="594" direction="left">

  <?php  include 'connections/mysql_connect.php';

            $sql = 'SELECT * FROM `events` ORDER BY `date_created` LIMIT 0, 30';

            $result = mysql_query($sql);

            while ($record = mysql_fetch_assoc($result)){

              echo "<a href=".$record['url'].">".$record['title']. "</a>      " ;

            }

  ?>

</marquee>

Archived

This topic is now archived and is 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.