<?php
$xml=simplexml_load_file("http://www.b92.net/info/rss/sport.xml");
$prva1=$xml->xpath("/channel/item/title[0]");
$druga1=$xml->xpath("/channel/item/link[0]");
$treca1=$xml->xpath("/channel/item/description[0]");
$prva2=$xml->xpath("/channel/item/title[1]");
$druga2=$xml->xpath("/channel/item/link[1]");
$treca2=$xml->xpath("/channel/item/description[1]");
$prva3=$xml->xpath("/channel/item/title[2]");
$druga3=$xml->xpath("/channel/item/link[2]");
$treca3=$xml->xpath("/channel/item/description[2]");
$prva4=$xml->xpath("/channel/item/title[3]");
$druga4=$xml->xpath("/channel/item/link[3]");
$treca4=$xml->xpath("/channel/item/description[3]");
$prva5=$xml->xpath("/channel/item/title[4]");
$druga5=$xml->xpath("/channel/item/link[4]");
$treca5=$xml->xpath("/channel/item/description[4]");
$prva6=$xml->xpath("/channel/item/title[5]");
$druga6=$xml->xpath("/channel/item/link[5]");
$treca6=$xml->xpath("/channel/item/description[5]");
$prva7=$xml->xpath("/channel/item/title[6]");
$druga7=$xml->xpath("/channel/item/link[6]");
$treca7=$xml->xpath("/channel/item/description[6]");
$prva8=$xml->xpath("/channel/item/title[7]");
$druga8=$xml->xpath("/channel/item/link[7]");
$treca8=$xml->xpath("/channel/item/description[7]");
$prva9=$xml->xpath("/channel/item/title[8]");
$druga9=$xml->xpath("/channel/item/link[8]");
$treca9=$xml->xpath("/channel/item/description[8]");
$con=mysql_connect("localhost", "user", "pass") or die ("Can't connect");
mysql_select_db("sport", $con);
mysql_query("create table vesti(ID int NOT NULL AUTO_INCREMENT, PRIMARY KEY(ID), Title text, Link text, Description text)");
mysql_query("insert into vesti (Title, Link, Description) values ($prva1, $druga1, $treca1)");
mysql_query("insert into vesti (Title, Link, Description) values ($prva2, $druga2, $treca2)");
mysql_query("insert into vesti (Title, Link, Description) values ($prva3, $druga3, $treca3)");
mysql_query("insert into vesti (Title, Link, Description) values ($prva4, $druga4, $treca4)");
mysql_query("insert into vesti (Title, Link, Description) values ($prva5, $druga5, $treca5)");
mysql_query("insert into vesti (Title, Link, Description) values ($prva6, $druga6, $treca6)");
mysql_query("insert into vesti (Title, Link, Description) values ($prva7, $druga7, $treca7)");
mysql_query("insert into vesti (Title, Link, Description) values ($prva8, $druga8, $treca8)");
mysql_query("insert into vesti (Title, Link, Description) values ($prva9, $druga9, $treca9)");
// Nisam siguran da li se ubacuju navodnici u polja tabele kada su u pitanju promenljive
$rezultat=mysql_query("select * from vesti");
while ($data=mysql_fetch_array($rezultat))
{
echo $data['Title'] . " " . $data['Link'] . " " . $data['Description'] . "<br>";
}
mysql_free_result($rezultat);
mysql_close($con);
// Ne znam gde je greska. Ne pokazuje gde je, samo izbacuje prazan ekran
?>
Da li uopšte valja ova moja zamisao ili ako neko ima bolji predlog neka se javi.
Hvala!