Jump to content

Need help getting PHP/mySQL data into XML


mishasoni

Recommended Posts

PHP noob here...

 

I am trying to convert mySQL data into XML format using PHP.  Unfortunately I have had no luck getting this to work and would greatly appreciate some help. My code is below. The 'name' node displays fine, but the 'desc' section does not display at all (note that within {desc} neither a database record nor a PHP include file will show up).

 

Code for XML file (workshop_details.php):

<?php require_once('http://www.agci.org/Connections/AGCI.php'); ?>

<?php
$colname_rsSciSessPast = "-1";
if (isset($_GET['recordID'])) {
  $colname_rsSciSessPast = (get_magic_quotes_gpc()) ? $_GET['recordID'] : addslashes($_GET['recordID']);
}
mysql_select_db($database_AGCI, $AGCI);
$query_rsSciSessPast = sprintf("SELECT * FROM Events WHERE EventID_pk = %s  AND EventType = 'Science Session' AND Events.EventDateEnd < CURRENT_DATE ", GetSQLValueString($colname_rsSciSessPast, "text"));
$rsSciSessPast = mysql_query($query_rsSciSessPast, $AGCI) or die(mysql_error());
$row_rsSciSessPast = mysql_fetch_assoc($rsSciSessPast);
$totalRows_rsSciSessPast = mysql_num_rows($rsSciSessPast);
?>


<?php
// Send the headers
header('Content-type: text/xml');
header('Pragma: public');        
header('Cache-control: private');
header('Expires: -1');
?><?php echo('<?xml version="1.0" encoding="utf-8"?>'); ?>
<WorkshopDetail>
  <?php if ($totalRows_SciSessPast > 0) { // Show if recordset not empty ?>
  <?php do { ?>

<WorkshopDetails>

       <WorkshopDetail>
	<name><b>About the Workshop</b></name>
	<desc><![CDATA[
		<?php echo $row_rsSciSessPast['SessionDescriptionWeb']; ?>]]>
	</desc>
       </WorkshopDetail>

       <WorkshopDetail>
	<name><b>Roster</b></name>
	<desc><![CDATA[<?php include("includes/roster.php");?>]]></desc>
       </WorkshopDetail>

    <?php } while ($row_rsSciSessPast = mysql_fetch_assoc($rsSciSessPast)); ?>
<?php } // Show if recordset not empty ?>
</WorkshopDetails>

<?php
mysql_free_result($rsSciSessPast);?>

 

Code from parent page (sciSess_details.php):

<script src="http://www.agci.org/SpryAssets/SpryEffects.js" type="text/javascript"></script>
<script src="http://www.agci.org/SpryAssets/xpath.js" type="text/javascript"></script>
<script src="http://www.agci.org/SpryAssets/SpryData.js" type="text/javascript"></script>

var dsWorkshopDetails = new Spry.Data.XMLDataSet("workshop_details.php", "WorkshopDetails/WorkshopDetail", {entityEncodeStrings:false});

...

<ul spry:region="dsWorkshopDetails" spry:repeatchildren="dsWorkshopDetails">
<li class="product" onclick="fadeOutContentThenSetRow('{ds_RowID}');" spry:select="selected" spry:hover="hover">{name}</li>
</ul>

<div id="infoArea" spry:detailregion="dsWorkshopDetails" width="517px" height="100%">{desc}
</div>


 

 

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.