I am new in php xml. I have below php code
$query = mysql_query("SELECT u.name, u.phone, m.email, m.mobile FROM user u, micards m WHERE m.usr_id=u.id ");
while ( $row[] = mysql_fetch_assoc($query))
}
foreach(array_filter($row) as $key =$value) {
$output[$value['phone']]['cards'][] = array(
'email' =$value['email'],
'mobile' =$value['mobile'],
'name' =$value['name']
);}
Can anyone tell me how can I get xml of this I want xml in below format ?
<phone>
<cards>
<email>..</email>
<mobile>..</mobile>
<name>..</name>
</cards>
<cards>
<email>..</email>
<mobile>..</mobile>
<name>..</name>
</cards>
</phone>
<phone>
<cards>
<email>..</email>
<mobile>..</mobile>
<name>..</name>
</cards>
<cards>
<email>..</email>
<mobile>..</mobile>
<name>..</name>
</cards>
</phone>