NBS Posted October 31, 2008 Report Posted October 31, 2008 Sveiki, cenšos cikliski izvilkt XML no sava DB. Cikls: for ($n=0; $n<$rows; $n++) { echo "<item>\n<name>" . $row->product_name . "</name>\n" . "<link>" . "http://localhost/index.php?page=shop.product_details&category_id=$row->category_id&flypage=shop.flypage&product_id=$row->product_id&option=com_virtuemart&Itemid=12" . "</link>\n" . "<price>" . $row->product_price . "</price>\n" . "<image>" . "http://localhost/components/com_virtuemart/shop_image/product/". $row->product_thumb_image . "</image>\n" . "<category>" . $row->category_name . "</category>\n" . "<category_full>" . $row->category_name ." > ". $row->product_name . "</category_full>\n" . "<category_link>http://localhost/index.php?page=shop.product_details&category_id=$row->category_id&flypage=shop.flypage&product_id=$row->product_id&option=com_virtuemart&Itemid=12</category_link>\n" . "<in_stock></in_stock>\n" . "</item>\n"; $row=mysql_fetch_object($sql_result); } Kļūda: [31-Oct-2008 13:32:04] PHP Parse error: syntax error, unexpected T_VARIABLE in index.php on line 40 [31-Oct-2008 13:46:56] PHP Parse error: syntax error, unexpected T_ECHO, expecting ',' or ';' in index.php on line 35 [31-Oct-2008 13:49:19] PHP Parse error: syntax error, unexpected T_STRING in index.php on line 1 Pilnais kods: http://paste.php.lv/8251?lang=php Vēlējos uzzināt arī Jūsu viedokli par XML vai šādā veidā ir vispār efektīvi iegūt datus un izveidot XML failu, jo saskaros ar xml pirmo reizi. Liels paldies, savlaicīgi.
andrisp Posted October 31, 2008 Report Posted October 31, 2008 Kāpēc tev $row tiek iegūts beigās nevis sākumā ?
NBS Posted October 31, 2008 Author Report Posted October 31, 2008 Nez, uzliku augšā, bet tāpat tā pati kļūda gan jau sintaksē ir kļūda, kuru es nevaru ieraudzīt :(
andrisp Posted October 31, 2008 Report Posted October 31, 2008 Foršs koderis tu esi, ja jau "nez". :) Sintakses kļūda tajā kodā it kā nav. Citur droši vien kodā.
NBS Posted October 31, 2008 Author Report Posted October 31, 2008 Pirmās 6 rindas: <?xml version="1.0" encoding="UTF-8"?> <?php set_time_limit(0); ignore_user_abort(); error_reporting(1);
andrisp Posted October 31, 2008 Report Posted October 31, 2008 Nu vot. Tev droši vien php shor tags ir ieslēgts.
NBS Posted October 31, 2008 Author Report Posted October 31, 2008 <?xml... bija pievainas vajadzēja <xml.... Bet labs jautājums kpc man neveidojas xml fails ? Bet tikai vērtību outputs ?
bubu Posted October 31, 2008 Report Posted October 31, 2008 <?xml vietā rakstot <xml tu neiegūsi korektu XML failu.
NBS Posted October 31, 2008 Author Report Posted October 31, 2008 Hmm, kas par vainu varētu būt ? Ja es atlieku atpakaļ tāpat kļūda :( Kā man pareizi izdarīt, lai strādātu ?
NBS Posted October 31, 2008 Author Report Posted October 31, 2008 Aizgāja outputs, bet nu galīgi nav līdzīgs XML :(
andrisp Posted October 31, 2008 Report Posted October 31, 2008 Ko tad tas nozīmē ? :) Tas, ka nav smuks indentings ? Tas jau neko nenozīmē.
NBS Posted October 31, 2008 Author Report Posted October 31, 2008 Uh :D Nebiju pamanījis :) Paldies visiem ;)
Recommended Posts