?
Solved

Flash: how to display results of data query - SQL vs. XML (or other)?

Posted on 2010-09-09
4
Medium Priority
?
458 Views
Last Modified: 2013-11-11
I am trying to create a flash Banner Advertisement that will use a database to create a ZIP Code locator. This advertisement will likely get a lot of hits so I need a very efficient solution.

The banner ad will let the user input a ZIP Code into a form field which, when submitted, will query a database to find matching data (i.e. store information) and then display the results in the flash banner file.

I *think* I can do this using an XML file (i.e. instead of querying a database, query the XML file) However, with 20,000+ ZIP Codes and related data nodes, this could be a HUGE XML file - and I'm not 100% positive it is possible.

Is it possible to query a database directly? I suspect so but my concern here is that the banner ad will get tons of hits and strain the database.

Has anybody done something like this before?

What is the best solution?!
0
Comment
Question by:bearclaws75
  • 2
4 Comments
 
LVL 9

Accepted Solution

by:
Jakob_E earned 1200 total points
ID: 33643567
Hi,

20,000 nodes of 5-50 characters each will result in a 150-450 KB XML file (you don't want that ;-)

I would do something like this:


// Function that submits the user input to the data base - that
// after processing returns XML containing just enough info
function submitToDB():void{
   
    // Loader and listener
    var loader:URLLoader=new URLLoader()
        loader.addEventListener(Event.COMPLETE,resultFromDBHandler,flase,0,true)
   
    // Request and request method (GET/POST)
    var request:URLRequest=new URLRequest("http://www.domain.com/getZipInfo.php")
        request.method=URLRequestMethod.POST;
   
    // Variables and values
    var vars:URLVariables
        vars.zipCodeInput="10007" // Replace with user input
       
    // Add variables to the request and load
    request.data=vars
    loader.load(request)
}


// Function to handle the XML returned
function resutlFromDBHandler(e:Event):void{
    var xml:XML=new XML(e.data)
    // do other stuff here
}





Best,
Jakob E



0
 
LVL 9

Expert Comment

by:Jakob_E
ID: 33643578
Second function should be resultFromDBHandler not resutl..

 
0
 
LVL 60

Assisted Solution

by:Kevin Cross
Kevin Cross earned 800 total points
ID: 33646660
Agree with above that you can go through PHP.  Here is a reference to support that using Flex.

http://cookbooks.adobe.com/post_Simple_MySQL_to_Flex-5561.html
0
 

Author Closing Comment

by:bearclaws75
ID: 33664713
Thanks. This is exactly what I was looking for.
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Creating and Managing Databases with phpMyAdmin in cPanel.
This post looks at MongoDB and MySQL, and covers high-level MongoDB strengths, weaknesses, features, and uses from the perspective of an SQL user.
The goal of the tutorial is to teach the user how to how to load their YouTube profile onto Flash Media Live Encoder.
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses
Course of the Month16 days, 22 hours left to enroll

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question