Reputation: 18948
I fetched some records from a table named a2h_member in php. i want to convert it into XML format. How can i do this?. Give me some suggestions or code. Please Help me
Upvotes: 0
Views: 669
Reputation: 27313
The simpler the better:
$xml = '<?xml version="1.0" encoding="UTF-8" ?><result>';
foreach($result as $row){
$xml .= '<row>';
foreach($row as $key=>$value){
$xml .= "<{$key}><![CDATA[{$value}]]></{$key}>";
}
$xml .= '</row>';
}
$xml .= '</result>';
Upvotes: 2