tiy Posted February 9, 2007 Report Share 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 Link to comment Share on other sites More sharing options...
andrisp Posted February 9, 2007 Report Share 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ā. Link to comment Share on other sites More sharing options...
tiy Posted February 10, 2007 Author Report Share 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? Link to comment Share on other sites More sharing options...
andrisp Posted February 10, 2007 Report Share Posted February 10, 2007 kas ir jv ? Link to comment Share on other sites More sharing options...
tiy Posted February 11, 2007 Author Report Share Posted February 11, 2007 ups, domaju javascript Link to comment Share on other sites More sharing options...
andrisp Posted February 11, 2007 Report Share 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ā. Link to comment Share on other sites More sharing options...
tiy Posted February 11, 2007 Author Report Share 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 Link to comment Share on other sites More sharing options...
andrisp Posted February 11, 2007 Report Share 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. Link to comment Share on other sites More sharing options...
tiy Posted February 11, 2007 Author Report Share 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? ?> Link to comment Share on other sites More sharing options...
bubu Posted February 11, 2007 Report Share Posted February 11, 2007 Nekabini visu stringā, bet vienkārši drukā ārā: echo "<user>"; ... Link to comment Share on other sites More sharing options...
tiy Posted February 11, 2007 Author Report Share 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 Link to comment Share on other sites More sharing options...
Recommended Posts