Hi all,
im a little bit puzzled with this one.
Im after creating a simplexml encoded file using php, which calls from a mysql database.
i have the following, but i dont see what is wrong with the syntax.
im a little bit puzzled with this one.
Im after creating a simplexml encoded file using php, which calls from a mysql database.
i have the following, but i dont see what is wrong with the syntax.
Code:
<?php
require_once("connect.inc.php");
$db = getConnectionMySql();
$stmt = $db->query("SELECT email, name, lastlogin FROM subscriber");
while ( $obj = $stmt->fetchObject()){
echo $obj->email . ":" . $obj->name . ":" . $obj->lastlogin . "<br />";
// print " <row>\n";
// print " <email>$email</email>\n";
//print " <name>$name</name>\n";
//print " <lastlogin>$lastlogin</lastlogin>\n";
//print " </row>\n";
}
$fp = fopen('subscribers.xml','w');
if(!$fp) {
die('Error cannot create XML file');
}
fwrite($fp,$stmt());
//fwrite( $fp, implode(”,$obj));
fclose($fp);
echo "XML has been written. <a href=\"subscribers.xml\">View the XML.</a>";
?>
Comment