Jump to content


Photo

Cycling through row data is not working


  • Please log in to reply
2 replies to this topic

#1 Avalanche

Avalanche
  • Members
  • PipPipPip
  • Advanced Member
  • 73 posts

Posted 11 July 2003 - 09:31 PM

[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.
DEFINE("YOU","Spending Too Much Time On The Computer");

#2 dammitjanet

dammitjanet
  • Members
  • Pip
  • Newbie
  • 9 posts
  • LocationUK

Posted 11 July 2003 - 10:26 PM

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

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

#3 Avalanche

Avalanche
  • Members
  • PipPipPip
  • Advanced Member
  • 73 posts

Posted 11 July 2003 - 11:09 PM

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:
DEFINE("YOU","Spending Too Much Time On The Computer");




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users