Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / Flash / Data Integration / May 2007



Tip: Looking for answers? Try searching our database.

A little nudge, please...

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
aniebel - 30 May 2007 11:45 GMT
Hi, I need to run a query and convert the results to an XML string. I *think* I
need to do all of this in PHP but I wanted to get some guidance as sometimes I
make things more difficult than necessary.

Do I have 2 scripts... one to query and one to process the results to XML? Or
can I put them both in the same script. To do the latter is not proper OOP
practice, correct?

Once that is done, I can get the data into Flash. I need it to be XML though
because the same data is being used elsewhere outside of Flash.

Is this the proper, most efficient way of handling this task?
MotionMaker - 30 May 2007 15:12 GMT
"Do I have 2 scripts... one to query and one to process the results to XML? "
Your call, it would depend on how you want to manage and construct your PHP
code.
"To do the latter is not proper OOP practice, correct?" If it is a simple
project, do on all one PHP script. If the project has certain potential of
expanding greatly and the code could be reusable in other needs, then looking
at how to decompose the script functionality and data is merited.

As for Flash it depends on the version of AS.

For AS2 you use the XML class and in particular the
http://livedocs.macromedia.com/flash/8/main/00002879.html.

There are many examples by searching Google. Here are two I posted:


http://www.hosfordusa.com/ClickSystems/courses/flash/examples/XMLPHPMySql/Ex01/X
MLPHPMySQLEx01_Doc.php


http://www.hosfordusa.com/ClickSystems/courses/flash/examples/XMLPHPMySql/Ex02/X
MLPHPMySqlEx02_Doc.php
aniebel - 30 May 2007 16:11 GMT
Thanks Lon, I understand the Flash end of it but I'm very new to PHP and MySQL.
This will certainly help me get started. How on earth did you google it? I
spent several hours yesterday searching for "PHP render XML and MySQL" in
various ways. I kept ending up with topics that were completely different than
what I was looking for.

The links are greatly appreciated.
MotionMaker - 30 May 2007 16:29 GMT
Try combinations of
flash actionscript mysql php xml
with example sample tutorials etc:

Of course now you see Flex and AS3 stuff floating into these word combos, so
you can also use AS2 as a possible filter or "Actionscript 2"
dzedward - 30 May 2007 17:47 GMT
here's an example of a php file i created that grabs data from mySQL and
creates xml on the fly.  hope this helps

<?php
require("inc/databaseseminar2.inc"); //this is where i connect to mySQL
echo "<?xml version=\"1.0\"?>";
echo "<seminars>";

                                                     $seminars =
mysql_query('SELECT hotel.SSEMINARCITY, hotel.SSEMDAYOFWEEK, hotel.SSEMDATE,
hotel.SSEMINARSTATE, hotel.SEMINARMONTH, hotel.ID,hotel.SSEMHOTEL,
hotel.SSEMADDRESS, hotel.SSEMCITY, hotel.SSEMSTATE, hotel.SSEMZIP,
hotel.SSEMTELEPHONE, hotel.SGOOGLE, hotel.INDUSTRY,
hotel.SGOOGLEAVAILABLE,ONOFF FROM hotel  WHERE hotel.ONOFF = "ON" AND
hotel.INDUSTRY = "FS" ORDER BY hotel.SSEMCITY ASC');
                                                     while($sem =
mysql_fetch_object($seminars)) {
                                                     $ssemid = $sem->ID;
                                                     $sseminarcity =
htmlspecialchars($sem->SSEMINARCITY);
                                                     $sseminarstate =
htmlspecialchars($sem->SSEMINARSTATE);
                                                     $sseminarday =
htmlspecialchars($sem->SSEMDAYOFWEEK);
                                                     $sseminardate =
htmlspecialchars($sem->SSEMDATE);
                                                     
echo("<seminar><city>$sseminarcity, $sseminarstate, $sseminarday,
$sseminardate</city></seminar>");
                                                     }
                                                    echo "</seminars>";
                                                     ?>
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.