Ernijs_E Posted July 27, 2011 Report Share Posted July 27, 2011 Sveiki, Gribēju jautāt vai nav kaut kāds vienkāršs variants kā no datubāzes izvadīt informāciju un izveidot xml failā? Quote Link to comment Share on other sites More sharing options...
briedis Posted July 27, 2011 Report Share Posted July 27, 2011 Kur tad vēl vienkāršāk par parastu ciklu un drukāšanu ārā? :) Protams, noteikti eksistē arī gatavi rīki tā darīšanai... Quote Link to comment Share on other sites More sharing options...
Grey_Wolf Posted July 28, 2011 Report Share Posted July 28, 2011 (edited) Protams, noteikti eksistē arī gatavi rīki tā darīšanai... Eksistet, jau droši vien eksistē, bet ņemot vērā to ka vienkārša XML faila gadījumā kods sastāv burtiski no pāris desmitu rindiņām, varu iedomāties kāds koda blāķis būs gatavam risinājumam. Kārtējo reizi: klase lai pieslēgtos DB, klase lai izvadītu no DB, klase lai konfigurētu XML tāgus utt. --- EDIT: primitīvā varjantā: <?php header("Content-type: text/xml"); echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n"; // #################### $db=mysql_connect($hosts, $users, $paswords); mysql_select_db("$dbname"); mysql_query("SET NAMES UTF8"); // #################### $query="SELECT a1, a2, a3 FROM tabulis "; $result= mysql_query($query); print "<pirmais_taags>\r\n"; while($row=mysql_fetch_array($result)){ print "<a1_taags>".$row['a1']."</a1_taags>\r\n"; print "<a2_taags>".$row['a2']."</a2_taags>\r\n"; print "<a3_taags>".$row['a3']."</a3_taags>\r\n"; } print "</pirmais_taags>\r\n"; mysql_free_result($result); ?> Edited July 28, 2011 by Grey_Wolf Quote Link to comment Share on other sites More sharing options...
daGrevis Posted July 28, 2011 Report Share Posted July 28, 2011 http://php.net/m...en/refs.xml.php Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.