Flash accessing database, but not getting refreshed values!?

  • brandnewdrew
  • Novice
  • Novice
  • User avatar
  • Posts: 22

Post 3+ Months Ago


Im new to the whole Flash w/ database programming, but have worked hard to make a voting program for my family's next website using FlashMX 2004, PHP, and a MySQL database.

It works great in my web browser (IE 5, Mac) and thankfully in Windows too! The only problem that I have is that in Windows it seems that my Flash site doesn't pull fresh values from my database. The voting program starts and pulls data, but it seems to be old values. Even when I refresh the page! The only way to get around this is to close Internet Explorer and reopen it.

This sucks b/c I made my program to prevent the same user from voting twice, but as my flash program doesn't reload fresh data it has no way of noticing that someone had just voted. This is so weird, and I am lost.

I naively was under the impression that once I started using databases I could always be assured that my data would be loaded in dynamically and fresh! Somehow, its dynamic but not fresh! Is this a caching problem? Is the php script that my flash program calls cached once by the browser maybe? If so, I'm still confused. I thought PHP scripts are executed freshly on the server each time, and can't be cached. Ok, Ill quite rambling, but PLEASE HELP! :(

Thank you!
-Drew :D[/flash]
  • brandnewdrew
  • Novice
  • Novice
  • User avatar
  • Posts: 22

Post 3+ Months Ago

Ok, super cool...I fixed the problem as far as I think, and I'm super happy! Yeah!

Big props to this website, its so jam packed with info. God I love this site!

I found some info that I tinkered with on this page:
Thank you lostinbeta!

Basically as far as I can tell, I needed to force my flash program to load in new data, and for some reason it was calling an old cached php script with cached values? I guess? Honestly, I have no clue, and if you could help tell me why it did this I'd be really grateful. But anyways, this is what I did:

Before loading in my script that filled my flash program with values from a database, I threw on randomness to the query string, thus giving the impression that I wanted a new php script each time, but in reality always acessing the same one:

//Create LoadVars object to pass in data
var sitestext:LoadVars = new LoadVars();
//load the text file containing variables for the voting results application
sitestext.load("results_load.php?" + new Date().getTime());

And that seemed to work!


Post Information

  • Total Posts in this topic: 2 posts
  • Users browsing this forum: No registered users and 7 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum

© 1998-2017. Ozzu® is a registered trademark of Unmelted, LLC.