PDA

View Full Version : Reading from MySQL


jayybird412
10-25-2003, 04:31 PM
I have a MySQL DB filled with data from a form submission from my site. One item is a vote, 1=Yes, 0=No. I don't know much in action script but I know I need some of this stuff:

New data:
voteycnt=variable for counting 1's (set to 0)
votencnt=variable for counting 2's (set to 0)
totalvotes=variable for total votes (set to 0)

For every record I have to:

IF vote=1 THEN voteycnt=voteycnt+1 AND totalvotes=totalvotes+1

IF vote=0 THEN votencnt=votencnt+1 AND totalvotes=totalvotes+1

Can someone post what the Actionscript would need to look like to have a live count in Flash and publish the percentage of Yes vs No? possibly with a measurement bar for each?

Thanks,

You can email me at info@firescottlayden.com

Billy T
10-26-2003, 10:28 AM
would probably be easiest to do the counting in asp or php or whatever you're using and then just say something like

echo "&y=$yCount&n=$nCount&t=$total";

do you know how to load this data into flash? If not, check out the loadVars tute.

cheers