Jump to content

Dynamic XML from database


benjipie

Recommended Posts

Hi,

 

I'm learning php and I'm trying to get to grips with dynamic xml and php coming from a database.  The trouble I am having is I can't get my code to give any output.  I don't get an error I message, I just can't get the xml to display.  If anyone can give me any pointers as to what I'm doing wrong that would be great...

 

Here's the code I have.

<?php 

DEFINE ('DB_USER', 'root');
DEFINE ('DB_PASSWORD', 'password');
DEFINE ('DB_HOST', 'localhost');
DEFINE ('DB_NAME', 'flashphpbible');

$link = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);
$query = "SELECT * FROM dynamicxml WHERE id=1";
$result = mysqli_query($link, $query);

$xmlData .= " ";
$xmlData .= "<store>\n";


while($row = mysqli_fetch_array($result));
{
$xmlData .= " <item>\n";
$xmlData .= " 	<name>".$row['name']."</name>\n";
$xmlData .= " 	<section>".$row['section']."</section>\n";
$xmlData .= " 	<price>".$row['price']."</price>\n";
$xmlData .= " 	<inStock>".$row['instock']."</inStock>\n";
$xmlData .= " </item>\n";

}

$xmlData .= "</store>\n";

echo "response=".$xmlData;
?>

 

Thanks for any help offered. 

Ben.

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.