Jump to content
php.lv forumi

xml pedejais elemnts


tiy

Recommended Posts

function get_data(who){

if (typeof (xmlhttp.responseXML.getElementsByTagName("nick")[who]) == 'undefined') {
	return -1;
}

nick=xmlhttp.responseXML.getElementsByTagName("nick")[who].childNodes[0].nodeValue;

return nick;

}

 

Bet vienalga tev ar algoritmu viss tur nav kārtībā.

Link to comment
Share on other sites

Meginaju 92 rinda ienest izmainas (xml.php) , bet tad vispar nestrada.

<?
 //xml.php
 //esam pieslegusgies datu bazei	
$a="";
foreach($usrid as $user){
	$a .="<user>";
	$a .="<id>".$user[0]."</id>";
	$a .="<nick>".$user[1]."</nick>";		
	$a .="</user>";	
}	
$list="<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>";
$list.="<users>";
$list.=$a;
$list.="</users>";	
//tagad list satur xml, ka vinu ir preizi japadaot atpakal?
?>

Link to comment
Share on other sites

bubu gandriz sanaca tikai vel vajadzeja piemest

 

header ("Content-type: text/xml"); //shito rindu un viss ok

echo "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>";

echo "<users>";

 

foreach($usrid as $user){

echo "<user>";

echo "<id>".$user[0]."</id>";

echo "<nick>".$user[1]."</nick>";

echo "</user>";

}

echo "</users>";

 

jo man tieshi xml veida vajadzeja

Link to comment
Share on other sites

×
×
  • Create New...