Hello Friends,
You must place the below added code in a blank PHP file without any HTML or BODY tag and keep this file on the action of the form of another fil with the click event of the Submit Button.
<?php
header('Content-type: text/xml'); // in order to display in your browser
$link = mysql_connect('localhost','root','');
mysql_select_db('cyber',$link);
$table="c_c"; // your table name here
$sql = "Select * from $table";
$run = mysql_query($sql, $link);
if( $run && mysql_num_rows( $run ) )
{
$doc = new DOMDocument( '1.0' );
$doc->formatOutput = true;
$doc->preserveWhiteSpace = true;
$root = $doc->createElement( $table.'s' );
$doc->appendChild( $root );
while( ( $fetch = mysql_fetch_assoc( $run ) )!== false )
{
$node = $doc->createElement( $table );
$root->appendChild( $node );
foreach( $fetch as $key => $value )
{
$key = $doc->createElement( $key );
$node->appendChild( $key );
$key->appendChild( $doc->createTextNode( $value ) );
}
}
//$doc->save("thelinks.xml"); //in order to save it in file
$xml_string = $doc->saveXML();
echo $xml_string;
?>