sjones Posted December 23, 2007 Share Posted December 23, 2007 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>"; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/82943-returning-values-in-a-tag/ Share on other sites More sharing options...
shocker-z Posted December 23, 2007 Share Posted December 23, 2007 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 Quote Link to comment https://forums.phpfreaks.com/topic/82943-returning-values-in-a-tag/#findComment-421843 Share on other sites More sharing options...
sjones Posted December 23, 2007 Author Share Posted December 23, 2007 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> Quote Link to comment https://forums.phpfreaks.com/topic/82943-returning-values-in-a-tag/#findComment-421864 Share on other sites More sharing options...
sjones Posted December 23, 2007 Author Share Posted December 23, 2007 That code above does not work for returning the url - its all just one big <a href> with the value of the last url returned. any help on how to return the title and url from the DB and scroll it in a marquee.?? Quote Link to comment https://forums.phpfreaks.com/topic/82943-returning-values-in-a-tag/#findComment-421876 Share on other sites More sharing options...
sjones Posted December 23, 2007 Author Share Posted December 23, 2007 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> Quote Link to comment https://forums.phpfreaks.com/topic/82943-returning-values-in-a-tag/#findComment-421896 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.