dflow Posted June 14, 2011 Share Posted June 14, 2011 i have a product and it's image gallery how do i create the image gallery as a subcategory in the xml output? <?php $hostname_conn = "localhost"; $database_conn = "international"; $username_conn = "root"; $password_conn = "root"; $conn = mysql_pconnect($hostname_conn, $username_conn, $password_conn) or trigger_error(mysql_error(),E_USER_ERROR); ?> <?php // Query the database and get all the records from the Images table mysql_select_db($database_conn, $conn); $query_rsAll = "SELECT * FROM `apartments` LEFT JOIN city_list ON apartments . city_id = city_list . cityid LEFT JOIN images ON apartments . id = images . id WHERE apartments . city_id = 1 "; $rsAll = mysql_query($query_rsAll, $conn) or die(mysql_error()); $row_rsAll = mysql_fetch_assoc($rsAll); $totalRows_rsAll = mysql_num_rows($rsAll); // 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"?>'); ?> <root> <?php if ($totalRows_rsAll > 0) { // Show if recordset not empty ?> <?php do { ?> <row> <?php foreach ($row_rsAll as $column=>$value) { ?> <<?php echo $column; ?>><![CDATA[<?php echo $row_rsAll[$column]; ?>]]></<?php echo $column; ?>> <?php } ?> </row> <?php } while ($row_rsAll = mysql_fetch_assoc($rsAll)); ?> <?php } // Show if recordset not empty ?> </root> <?php mysql_free_result($rsAll); ?> Link to comment https://forums.phpfreaks.com/topic/239332-generate-xml-on-the-fly-sub-categories/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.