NBS Posted October 31, 2008 Report Share 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. Link to comment Share on other sites More sharing options...
andrisp Posted October 31, 2008 Report Share Posted October 31, 2008 Kāpēc tev $row tiek iegūts beigās nevis sākumā ? Link to comment Share on other sites More sharing options...
NBS Posted October 31, 2008 Author Report Share 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 :( Link to comment Share on other sites More sharing options...
andrisp Posted October 31, 2008 Report Share 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ā. Link to comment Share on other sites More sharing options...
NBS Posted October 31, 2008 Author Report Share Posted October 31, 2008 Ņja, nevaru atrast :( Link to comment Share on other sites More sharing options...
andrisp Posted October 31, 2008 Report Share Posted October 31, 2008 Nu kas tev ir ieks 1. rindiņas ? Link to comment Share on other sites More sharing options...
NBS Posted October 31, 2008 Author Report Share 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); Link to comment Share on other sites More sharing options...
andrisp Posted October 31, 2008 Report Share Posted October 31, 2008 Nu vot. Tev droši vien php shor tags ir ieslēgts. Link to comment Share on other sites More sharing options...
NBS Posted October 31, 2008 Author Report Share 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 ? Link to comment Share on other sites More sharing options...
bubu Posted October 31, 2008 Report Share Posted October 31, 2008 <?xml vietā rakstot <xml tu neiegūsi korektu XML failu. Link to comment Share on other sites More sharing options...
NBS Posted October 31, 2008 Author Report Share 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 ? Link to comment Share on other sites More sharing options...
bubu Posted October 31, 2008 Report Share Posted October 31, 2008 <?php echo "<?xml version=... >"; ... ?> Link to comment Share on other sites More sharing options...
NBS Posted October 31, 2008 Author Report Share Posted October 31, 2008 Aizgāja outputs, bet nu galīgi nav līdzīgs XML :( Link to comment Share on other sites More sharing options...
andrisp Posted October 31, 2008 Report Share Posted October 31, 2008 Ko tad tas nozīmē ? :) Tas, ka nav smuks indentings ? Tas jau neko nenozīmē. Link to comment Share on other sites More sharing options...
NBS Posted October 31, 2008 Author Report Share Posted October 31, 2008 Uh :D Nebiju pamanījis :) Paldies visiem ;) Link to comment Share on other sites More sharing options...
Recommended Posts