Jump to content

Archived

This topic is now archived and is closed to further replies.

Avalanche

Cycling through row data is not working

Recommended Posts

[php:1:3d07c06ba5]<?php

$query_events = mysql_query(\"SELECT * FROM bob_events ORDER BY ID DESC\");

?>[/php:1:3d07c06ba5]

 

[php:1:3d07c06ba5]<?php

while($r=mysql_fetch_array($query_events)) { // cycle through events

$event=$r[\"event\"]; // turn row variable to regular variable

$event = addslashes($event);

echo \"scrollercontent[0]=\'<b>-</b> $event\'n\"; // add on to scrollies

}

?>[/php:1:3d07c06ba5]

 

I have two events in the table, but it will only echo the last one.

 

The two ones are: \"Cool Website Scripts\" and \"New addition to the Wile\'s family.\"

 

Any idea why this is not working?

 

Thanks.

Share this post


Link to post
Share on other sites

echo "scrollercontent[0]=\'<b>-</b> $event\'n"; // add on to scrollies 

 

thats your probelm - you are replacing the content - not adding to it..

Share this post


Link to post
Share on other sites

I know, I was going to fix that later...

 

anyway, I just figured out what it was.

 

I had it start echoing it on one of the JavaScript\'s comment lines instead of a command line... I just had to add a n to the echo above it and it all worked out.

 

Whoops. :roll:

Share this post


Link to post
Share on other sites

×

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.