I want to display results in a marquee..

Discussion in 'PHP' started by adamjblakey, Jul 12, 2007.

  1. #1
    Hi,

    I have a table with about 10 entries in and i want to display them all in a <marquee> scrolling but when i put them in a while loop then come out on 10 lines rather than one line one after another.

    Here is the current code:

    <?php
    						$selectsqw = "SELECT * FROM loads WHERE deliverydate > DATE_ADD(NOW(),INTERVAL -48 HOUR)+0 ORDER BY id DESC LIMIT 0, 5";
    						$resultqw = mysql_query($selectsqw);		
    						$countrowssaqw = mysql_num_rows($resultqw);
    									
    						 if ($countrowssaqw > 1) {
    				
    							while ($resqw = mysql_fetch_array($resultqw)) {
    							$resuqw[] = $resqw;	
    						}
    												
    							mysql_free_result($resultqw);
    							foreach ($resuqw AS $rowqw) {
    							
    						?>
    						<marquee><h1>Latest Loads: 
    						<?php echo "".$rowqw['collecttown']." - ".$rowqw['delivertown']." - ".$rowqw['loadready'].""; ?>
    						</h1>
    						</marquee>			
    									
    			
    						<?php
    					
    					}
    					}
    					
    					?>		
    Code (markup):
    Any ideas how i can get them all on one line?

    Cheers,
    Adam
     
    adamjblakey, Jul 12, 2007 IP
  2. ecentricNick

    ecentricNick Peon

    Messages:
    351
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Yes, by default, H1 tags insert a line break.

    Override this by adding the following in your style sheet for a particular class of H1...

    display: inline;
     
    ecentricNick, Jul 12, 2007 IP
  3. adamjblakey

    adamjblakey Active Member

    Messages:
    1,121
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    80
    #3
    That still seems to add them on multiple lines and i have changed the <h1> to <b> e.g.

    Latest Loads: - - 2007-07-12
    Latest Loads: - - 2007-07-12
    Latest Loads: - - 2007-07-12
    Latest Loads: - - 2007-07-12
     
    adamjblakey, Jul 12, 2007 IP
  4. ecentricNick

    ecentricNick Peon

    Messages:
    351
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Well, move the marquee tag outside of your loop?

    So instead of...
    <marquee>text 1</marquee>
    <marquee>text 2</marquee>

    You have...
    <marquee>text 1&nbsp;text2&nbsp;</marquee>
     
    ecentricNick, Jul 12, 2007 IP
  5. JEET

    JEET Notable Member

    Messages:
    3,832
    Likes Received:
    502
    Best Answers:
    19
    Trophy Points:
    265
    #5
    Try putting the marquee and h1 tags outside foreach loop, like this:

    <marquee><b>Latest Loads: </b>
    <?php
    foreach ($resuqw AS $rowqw) {
    echo "".$rowqw['collecttown']." - ".$rowqw['delivertown']." - ".$rowqw['loadready']."";
    }
    ?>
    </h1>
    </marquee>
    Bye :)

    ---should have typed faster...--- ;)
     
    JEET, Jul 12, 2007 IP
  6. adamjblakey

    adamjblakey Active Member

    Messages:
    1,121
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    80
    #6
    Thanks works fine now :)
     
    adamjblakey, Jul 12, 2007 IP