Radi se o parsiranju xml fajla čiji elementi (<title> <link> i <description>) treba da se upisu u bazu. Problem je što se u bazi pojavljuje samo prvih 5 do 8 redova .. ne razumem zašto ? pls help treba da upišem mnogo više elemanata u bazu
<?php
$db_host = "localhost";
$db_user = "root";
$db_pwd = "";
$db_name = "rss";
mysql_connect($db_host, $db_user, $db_pwd);
mysql_select_db($db_name);
?>
<html>
<head>
<title>Vesti preuzete iz xml fajla u Mysql bazi</title>
</head>
<body>
<?php
function parse_rss($f) {
$xmlfile = fopen($f, 'r');
if (!$xmlfile) die('cannot open the xml file');
$readfile = fread($xmlfile ,80000);
$parsefile = eregi("<item>(.*)</item>", $readfile ,$arrayreg); //stavlja u arrayreg
$filechunks = explode("<item>", $arrayreg[0]);
$count = count($filechunks);
for($i=1 ; $i<=$count-1 ;$i++) {
ereg("<title>(.*)</title>",$filechunks[$i], $title);
ereg("<link>(.*)</link>",$filechunks[$i], $links);
ereg("<description>(.*)</description>",$filechunks[$i], $description);
echo str_replace('hxaxh','a',"<li><font style='font-size: 12px;'><hxaxh target=_blank href ='".$links[1]."'\>".
utf8_decode($title[1])."</hxaxh></font>");
echo "<br><font color=gray style='font-size: 10px;'>".utf8_decode($description[1])."</font></li>";
$q="INSERT INTO b92 (naslov, link, opis) VALUES ('".$title[1]."' , '".$links[1]."' , '".$description[1]."')";
if (!mysql_query ($q)) die ("Greska!");
}
}
$xmlfeed = 'http://rss.freshmeat.net/freshmeat/feeds/fm-releases-global';
parse_rss($xmlfeed);
?>
</body>
</html>
baza ima1 tabelu u kojoj ima 3 kolone: naslov(varchar (255)) link(varchar (255)) opis (text)
A bored mind is a playground for hell