Jump to content

returning values in a <marquee> tag


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>

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.