How To Do This Better

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
dhavalshah83
Forum Newbie
Posts: 3
Joined: Fri Jun 09, 2006 8:18 am

How To Do This Better

Post by dhavalshah83 »

I am currently woring on a project wich involves Flash, XML, MySql, PHP. I have to populate flash map with countries & upon clicking cities from the database.

But the thing is the cities can keep on changing, some may be deleted & new ones can be added. So the solution i have developed revolves around rewriting the city.xml when a country is clicked.

Is there a better solution, something that will directly pass values to the flash file without writing to the file itself & save me some valuble I/O time ?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

PHP script that renders in XML?
dhavalshah83
Forum Newbie
Posts: 3
Joined: Fri Jun 09, 2006 8:18 am

Post by dhavalshah83 »

i don't know if there is a better solution, if there is 1 want to know .....
Last edited by dhavalshah83 on Fri Jun 09, 2006 8:39 am, edited 1 time in total.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Having a php script render the XML wouldn't require it writing to a file. If you're going to update the XML data every request, there's no reason to have a static file is there? So a PHP script that renders to XML is more ideal. As for the "perfect" solution, it's the only one you have an option for in this case.
User avatar
nathanr
Forum Contributor
Posts: 200
Joined: Wed Jun 07, 2006 5:46 pm

Post by nathanr »

feyd wrote:Having a php script render the XML wouldn't require it writing to a file. If you're going to update the XML data every request, there's no reason to have a static file is there? So a PHP script that renders to XML is more ideal. As for the "perfect" solution, it's the only one you have an option for in this case.
indeed you can simply do the following: create a folder http://www.mydomain.com/xml/
have an index.php within that folder that outputs xml on the fly
output the xml from the file as such

Code: Select all

header('Content-type: text/xml');
echo '<?xml version="1.0" encoding="ISO-8859-1"?>';
echo $xml;
this method makes sure all browsers and apps can recognise its xml

have your flash movie pull in the xml from http://www.mydomain.com/xml/ and NOT http://www.mydomain.com/xml/index.php

8O [ or just use javascript to get the values via ajax and pass the values to the movie, or intensive action script to pull in the info directly]

edit: this might help, actionscript > php > mysql (simple)
dhavalshah83
Forum Newbie
Posts: 3
Joined: Fri Jun 09, 2006 8:18 am

Post by dhavalshah83 »

thanx for the help .. !!! :D
Post Reply