
teo
By:
delmoras on
Jul 13th, 2012 | syntax:
PHP | size: 0.88 KB | hits: 18 | expires: Never
<?php
header("Content-type: text/xml");
// EDO THA VALEIS CONNECT GIA MYSQL KLP
// AFTI I FUNCTION KANEI ENCODE TO XML
function xmlencode($string) {
//
//$string = str_replace("<", "<", $string);
$string = strip_tags($string);
$string = str_replace("&", "", $string);
$string = str_replace("","",$string);
return $string;
}
?>
<?php echo '<?xml version="1.0" encoding="utf-8"?>
'; ?>
<THODORIS name="ninja" url="www.ninja.com" encoding="utf8">
<products>
<?
//p.x. theleis na trexeis ena query gia ta x kai y opote to grafeis edo kai meta tiponeis ta //elements sou kai esai etoimos
$sql = "SELECT * FROM ninja WHERE name = {$_GET['x']} AND lastname = {$_GET['y']}";
$res = mysql_query($sql);
while($row = mysql_fetch_array($res))
{
echo "<item>".xmlencode($row['name'])."</item>";
}
?>
</products>
</THODORIS>