-
What would be a better choice?
Using mySQL and PHP, or XML?? And why
-
Uhm...
If your trying to compare Databases... XML would be slightly above the level of... a flat text file of name/value pairs...
I would recommend looking into what XML is before you get into using it or not using it...
In most cases I store everything in a MySQL database, pull it from the DB using PHP, and send it to a Flash front end using XML. No joke. Having that many different stages seems to work best... that way I can change my interface however I want, and not have to worry about the data transfer.
Now... if you're talking like XML is a scripting language like PHP... then you've really got some research to do...
-
very true, i find that well organized mysql tables allow for easy transfers. i use the same method:
mysql for data
php to create xml (dynamically)
xml to flash
im a beginner but recently just created a movie which does this. pretty simple and a lot of fun
good luck
-
How would I go about dynamicaly creating XML with PHP?
-
Uhm...
I'm assuming you can make HTML with PHP.. XML is the same. Tags, attributes, text... Look into XML and you'll see it's easy to do basic stuff - then if you wanted to get into the more complex things, PHP has interfaces to generate XML.
-
you would loop your script to draw data from the mysql table and print out the tags
-
I'm quite addept at PHP, but I've never examined the XML usage of it, I'll take a look.
Does the PHP have to actually create am XML file? Cause that would mean that if it were on a server which was on 'safe mode' the code wouldn't work.
-
you could try something like this
Code:
//fetch the data from the table
$result = mysql_query("SELECT * FROM $table", $link);
for ($i=0;$i<mysql_num_rows($result);$i++)
{
$data[] = mysql_fetch_array($result,MYSQL_ASSOC);
}
/*
data now contains an associative array
make it into XML
*/
$xml_data = '<dbData>';
foreach($data as $key=>$val)
{
//$xml_data .= "<id value=pic>";
$xml_data .= "<pic>";
foreach ($val as $nKey=>$nVal)
{
$xml_data .= "<$nKey>$nVal</$nKey>";
}
$xml_data .= "</pic>";
}
$xml_data .= '</dbData>';
//echo $xml_data;
//write to xml file
$fp = fopen($xml_name,'w') or die("Couldnt open $xml_name");
fwrite($fp, $xml_data);
fclose($fp);
echo "success!";
you get it, just a standard forloop from the array
-
tnx, but it won't work on a safe mode server.
-
I´m exploring the possibiltys of mySQL, php en XML connections and data transfer, but I´m am still not really clear on what this can do to a Flash movie, does anyone have any exapmles of such sites / Swf´s that use this connection in an effective way ???
-
ive been working on one lately, its going to be a picture gallery.
i created a php page where i can submit a pic, title, and description. the script automatically inserts thisinformation into a mysql database. after this is done, it creates an xml file with the data.
the flash gallery then takes the name, description, and filename from the xml and loads it directly inside the movie. everything is dynamic, meaning i will never have to change the .fla if i want to add something to my gallery. all i have to dois submit it with the php page
hope that helps
-
oh yeah when im done ill release it in the forums so everyone can check it out.
-
Uhh...
I know that::
http://www.perryhomesutah.com
and
http://www.utahvalley4x4.com
Use Flash on the front-end, MySQL on the back-end, and PHP to format XML that is given to the Flash...
It's very simple what this can do WITH a Flash movie... Flash displays data, MySQL holds it, PHP talks to MySQL and gives the data to Flash in an XML format...
-
Senior Member
Does Mysql work with Flash?
-
Uhm...
WARNING - THIS IS MEANT TO BE FUNNY
Do you know what MySQL is??
Do you know what Flash is??
WARNING - THAT WAS MEANT TO BE FUNNY
So... the short answer - yes.
Good enough?
If you're asking - Can Flash execute SQL queries directly - No.
If you're asking - Can some middleware (PHP, ASP, JSP) send information from a MySQL database to Flash - Yes.
-
Why use XML? - I'm a beginner
I understand using PHP (or ASP) to populate a database and then pulling that data from the database to display in Flash (through PHP, ASP, etc.), but what value does XML add to the party?
-
Uhm...
If you've ever had to serialize or deserialize data, to be exchanged between anything, you'd see the 'coolness' of XML.
Aside from the fact that all - and I mean ALL of the major players try to put XML in their products somehow... and aside from the fact that XML is meant to not be tied to a 'standards definition'... it really isn't that much.
BUT since it is everywhere, and everything can 'parse' XML, and since it is not tied to a strict standard (is you can make up your own tags if you want) - it rocks.
For instance...
Flash can not 'understand' PHP, and PHP can not 'understand' Flash - but both of them 'understand' XML... so that's one way they can communicate.
-
Senior Member
XML is to Data what RTF is to documents!
When all else fails you know that XML (or RTF in the case of documents) will work.
Thanks
Luke
-
Senior Member
How well does PHP undertstand XML?
-
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|