How can I extract data of an external XML to PHP?

AS3 & PHP. how come everytime I call the php file I get the same data?

  • I have this .fla file. i created 2 classes; Grabber and Saver. Everything is working fine except for one thing. everytime I call it (ctrl + Enter or index.html) the same data keeps pulling out. the Grabber class calls getClient.php. getClient.php loads index.php wich has a mysql satement to get info from DB and return it. THE .fla file import com.getFiles.xml.*; import com.getFiles.php.*; import fl.controls.*; var info_txt:TextArea = panel_mc.main_mc.info_txt; var grabber:Grabber = new Grabber(); var saver:Saver = new Saver(); function dataGrabbed(event:Event):void{ info_txt.text = "saving grabbed data"; saver.addEventListener(Event.COMPLETE… fileSaved); saver.save("saver.php", "data.xml", grabber.data); } function fileSaved(event:Event):void{ info_txt.text = grabber.data; } grabber.load("getClient.php", "index.php");//second arq is the addr grabber.addEventListener(Event.COMPLET… dataGrabbed); getClient.php-->> <?php $file = $_POST['fileName']; include("index.php"); //$file goes in here. either way it works echo $content; ?> index.php-->> <?php include("db_conn.php"); $sql = "SELECT * FROM artistBattle"; $result = mysql_query($sql, $conn) or die(mysql_error()); while ($newArray = mysql_fetch_array($result)){ $art1= $newArray['art1']; $vid1= $newArray['vid1']; $art2= $newArray['art2']; $vid2= $newArray['vid2']; $points= $newArray['points']; $battleStat = $newArray['artStat']; $content = "<?xml version=\"1.0\" encoding=\"utf-8\"?> <gallery> <?processing instructions?> <art id=\"$art1\"> <vid1>$vid1</vid1> <points>$points</points> </art> <art id=\"$art2\"> <vid1>$vid2</vid1> <points>$points</points> </art> </gallery>"; } ?>

  • Answer:

    If you aren't specifying WHERE criteria in your SQL code, it's going to give you everything. You either have to make your SQL parameter-driven to build a WHERE clause or else add php code to scan each resultset row fetched to decide which ones you want to display. (The former is more typical, but just be sure to do so in such a manner you don't expose yourself to SQL-injection attacks.)

Christopher Robbin at Yahoo! Answers Visit the source

Was this solution helpful to you?

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.