Jump to content

fatal error


spangle1187

Recommended Posts

Hi guys and girls,

 

I am trying to create an XML document from an php document and a sql_query but I am getting this fatal error:

 

Fatal error: Call to undefined method DOMComment::createElement() in /content_ro/webdev/htdocs/schools/hhs/psy_bookings/home.php on line 15

 

<?php

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


					$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 DOMComment('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);
					}
					}

					mysql_free_result($room1);

					$xml_string = $doc->saveXML();

					echo $xml_string;
					?>

 

I am following a tutorial on http://www.tonymarston.net/php-mysql/dom.html

 

Link to comment
https://forums.phpfreaks.com/topic/225943-fatal-error/
Share on other sites

The code is now working and echoing to the screen the data and inthe source view the data is in xml nodes. The next step is to get actionscript to read the xml file and take the data into flash and not echo it to the screen. What procedure would I need to complete this?

Link to comment
https://forums.phpfreaks.com/topic/225943-fatal-error/#findComment-1166517
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.