Location: PHPKode > projects > phpMyPrepaid > phpmyprepaid/www/include/divers/findAccountGroup.php
<?php
include_once('../../config.inc.php');
if (!isset($_SESSION['oreon'])) Session::Start();
$oreon=$_SESSION['oreon'];
$user=$_GET["user"];
$loc=$_GET["loc"];

if ($user!='')
$result = $_SESSION["oreon"]->database->database->query("SELECT UserName,BillingPlan,Type FROM userinfo WHERE UserName REGEXP ('$user') AND LocationID='$loc'");
else
$result = $_SESSION["oreon"]->database->database->query("SELECT UserName,BillingPlan,Type FROM userinfo WHERE  LocationID='$loc'");

//Création du flux XML et du fichier XML en utilisant DOM
 $dom = new DomDocument('1.0');

 //ajout de l’élément principal - <books>
 $users = $dom->appendChild($dom->createElement('users'));

 //ajout de l’élément <book> à l’élement <books>
$user = $users->appendChild($dom->createElement('user'));


 while ($row = $oreon->database->database->fetch_object($result)) {
 $name = $user->appendChild($dom->createElement('name'));
 $name->appendChild($dom->createTextNode($row->UserName));
 $bp = $user->appendChild($dom->createElement('BillingPlan'));
 if ($row->BillingPlan==0) 
	 $bp->appendChild($dom->createTextNode('None'));
 else
	 $bp->appendChild($dom->createTextNode(get_plan_name($row->BillingPlan)));
 $typef = $user->appendChild($dom->createElement('Type'));
 $typef->appendChild($dom->createTextNode($row->Type));
 $user = $users->appendChild($dom->createElement('user'));

}

//génération du flux xml
 $dom->formatOutput = true; // définition du format de sortie à « true »
// Sauvegarde de l’XML en tant que flux texte ou fichier
 $str = $dom->saveXML(); // sauvegarde du flux dans la varialbe $test1
echo $str;
?>
Return current item: phpMyPrepaid