tiy Posted February 9, 2007 Report Posted February 9, 2007 Ka uzzinat, kad no xml faila vairs nav datu? 11 rinda es chekoju vai ir kaut kas atnacis no xml faila, bet tas cheks nenostrada? Gribetos ta, kad ir pedejais elemnts tad vairak id numurs neskaitas klat (30rinad), un ir attiecigs pedejam id. http://paste.php.lv/5093 scripts http://paste.php.lv/5092 xml
andrisp Posted February 9, 2007 Report Posted February 9, 2007 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ā.
tiy Posted February 10, 2007 Author Report Posted February 10, 2007 Rodas jautajums man ir poga >,kur uz onClick stav piem. (query), ka panakt, lai jv vaica query.php?id=1, un ka atgriezt datus jv, lai vinsh tos saprot?
andrisp Posted February 11, 2007 Report Posted February 11, 2007 92. rindiņā norādi query.php?id=1 Un kur problēma apstrādāt datus ? Tu jau to dari šajā skriptā.
tiy Posted February 11, 2007 Author Report Posted February 11, 2007 (edited) pec query izpildes es ar php apstradaju datus un kada formata man tie janodot ? Vai man ir xml formata tie dati japadot? Edited February 11, 2007 by tiy
andrisp Posted February 11, 2007 Report Posted February 11, 2007 Nav obligāti. Var padot ari vienkārši iekš GET, jeb, fails.php?var=bla&var2=ble. xhr pieprasījums ir tādi pats kā jebkurš cits http pieprasījums - vari sūtīt datus gan caur get, gan caur post.
tiy Posted February 11, 2007 Author Report Posted February 11, 2007 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? ?>
bubu Posted February 11, 2007 Report Posted February 11, 2007 Nekabini visu stringā, bet vienkārši drukā ārā: echo "<user>"; ...
tiy Posted February 11, 2007 Author Report Posted February 11, 2007 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
Recommended Posts