I need to use multiple queries and send them out as well formed xml for as3 purposes.
When I use only one query everything works fine.
Problem starts when multi-query operates.
Right now when //XML header is hidden I get a structure printed on screen and it looks good.
But when header goes enabled, nothing works!
Please take a look at my code:
<?php
$dbHost = "localhost";
$dbUser = "root";
$dbPass = "";
$dbName = "test";
$dbTable = "pizzaroma";
$mysqli = mysqli_connect($dbHost, $dbUser, $dbPass, $dbName);
if ($mysqli->connect_errno)
echo "la conection ha fallado: ".$mysqli->connect_errno;
$query = "SELECT * FROM ".$dbTable." WHERE cat='pizza' AND act='1' ORDER BY ID ASC; ";
$query .= "SELECT * FROM ".$dbTable." WHERE cat='pasta' AND act='1' ORDER BY ID ASC; ";
if ($mysqli->multi_query($query)) {
// header("Content-type: text/xml");
echo "<?xml version='1.0' encoding='UTF-8'?>";
echo "<pics>";
do {
echo "<theme name='temporaly'>";
if ($result = $mysqli->store_result()) {
while ($row = $result->fetch_assoc()) {
echo "<pic name='".$row['NAME']."' desc='".$row['DESCES']."' price='".$row['PRICE']."'/>";
echo "</pic>";
}
$result->free();
}
echo "</theme>";
if ($mysqli->more_results()) {
}
}
while ($mysqli->next_result());
echo "</pics>";
}
$mysqli->close();
?>