Forum Moderators: coopster
include ("../functions/dbinfo.php");
$cntr=0;
//get the list of feeds
$sql2 = mysql_query("SELECT * FROM feeds");
$num_feeds = mysql_num_rows($sql2);
if ($cntr<$num_feeds) {
while ($row = mysql_fetch_array($sql2)) {
$feedName = $row['name'];
$feedNetwork = $row['network'];
$xml = simplexml_load_file ("../cache/".$feedName.".xml");
//parse the feed based on feed format (parser also does insert)
switch ($feedType) {
case "1":
include ("parsers/feed1.php");
break;
case "2":
include ("parsers/feed2.php");
break;
}
$cntr++;
}
}
if ($cntr<$num_feeds) {
while ($row = mysql_fetch_array($sql2)) { while (($cntr<$num_feeds) && ($row = mysql_fetch_array($sql2))) {
include ($_SERVER['DOCUMENT_ROOT'] . "/functions/dbinfo.php");
//get the list of feeds
$sql2 = mysql_query("SELECT * FROM feeds");
while ($row = mysql_fetch_array($sql2)) {
$feedName = $row['name'];
$feedNetwork = $row['network'];
$feedType=$row['feedType']; // See penders's Q
$xml = simplexml_load_file ($_SERVER['DOCUMENT_ROOT'] . " /cache/".$feedName.".xml");
//parse the feed based on feed format (parser also does insert)
// If it's feed 1 and 2 and $feedType is 1 or 2, just use the variable.
// It will interpolate if double quoted.
include ("$_SERVER['DOCUMENT_ROOT'] . "parsers/feed$feedType.php");
}
include ($_SERVER['DOCUMENT_ROOT'] . "/functions/dbinfo.php");
//get the list of feeds
$sql2 = mysql_query("SELECT * FROM feeds");
while ($row = mysql_fetch_array($sql2)) {
$id = $row['id'];
$feedName = $row['name'];
$feedNetwork = $row['network'];
$feedType=$row['feedType'];
if (($feedType==1) or ($feedType==2)) {
$xml = simplexml_load_file ($_SERVER['DOCUMENT_ROOT'] . "/cache/".$feedName.".xml");
//parse the feed based on feed format (parser also does insert)
// If it's feed 1 and 2 and $feedType is 1 or 2, just use the variable.
// It will interpolate if double quoted.
include ($_SERVER['DOCUMENT_ROOT'] . "/parsers/feed$feedType.php");
}
else { your_custom_logging_function("record ID $id has no feed type"); }
}
Anyway, I've taken out the if statement and implemented the " include ($_SERVER['DOCUMENT_ROOT'] . "/parsers/feed$feedType.php"); " statement instead of the switch and everythings working great now thanks.