Jump to content

creating an xml document that does not print to the screen


spangle1187

Recommended Posts

I have managed to retrieve an sql query and through php create an xml document, my next aim is to get this code into actionscript so that I can use the data in Flash. One problem I am experiencing is that in creating the xml document the data within xml nodes are echoed to the screen, I do not want them to be echoed to the screen just picked up by actionscript. Is there a way to created an xml document using php that does not print to the screen?

 

<?php

include("php/dbconnect.php"); //connects to the database


					//sql_query
					$table_id = 'booking'; 	
					$query = "SELECT * FROM $table_id WHERE (booking.bookingDate = curDate()) AND roomID = 1 ORDER BY startTime";
					$room1 = mysql_query($query);


					//create a new DOM document
					$doc = new DOMDocument('1.0');

					//create root element
					$root = $doc->createElement('root');
					$root = $doc->appendChild($root);

					//process one row at at time
					while($row = mysql_fetch_assoc($room1)){

					//add node for each row
					$occ = $doc->createElement($table_id);
					$occ = $doc->appendChild($occ);

					//add achild for each field
					foreach ($row as $fieldname => $fieldvalue){

					$child = $doc->createElement($fieldname);
    					$child = $occ->appendChild($child);


					$value = $doc->createTextNode($fieldvalue);
    					$value = $child->appendChild($value);
					}
					}

					$xml_string = $doc->saveXML();

					echo $xml_string;

					mysql_free_result($room1);
					?>

Link to comment
Share on other sites

My misunderstanding, the client in this case is loading a php page that upon loading runs an sql_query to a MySQL DB that then displays a visual using Flash representation of this query.

 

The client does not request to see the xml page and that is why I am trying not to echo the data to the screen.

 

I was advised that ActionScript and Flash can read xml very well so that is why I am creating the xml page.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.