madmatter23
03-08-2008, 01:28 AM
Hello,
I'm using a PHP page to draw information from an SQL database and generate and RSS feed via XML. Lots of acronyms huh?
Anyway, I've pretty much finished the whole thing... it's just not working. I'm not sure why.
Essentially, when you view the xml page, none of the items show up. But when viewing the source, everything looks right. The xml seems to be generated correctly, so I'm not sure what's causing the issue.
Here's the php
<?php
include "phpdb/dbaccess.php";
header( 'Content-Type: text/xml' );
echo "<?xml version='1.0' ?>
<?xml-stylesheet href='rss.xsl' type='text/xsl' media='screen' ?>
<rss version='2.0'>
<channel>
<title>Turning the Tide</title>
<language>en-us</language>
<link>http://www.maggiepascal.com/</link>
<description>Turning the Tide</description>
<webMaster>matt@knowideaproductions.com</webMaster>
";
$timeConvert = array (
"01:00:00" => "1am", "02:00:00" => "2am", "03:00:00" => "3am", "04:00:00" => "4am", "05:00:00" => "5am", "06:00:00" => "6am", "07:00:00" => "7am", "08:00:00" => "8am", "09:00:00" => "9am", "10:00:00" => "10am", "11:00:00" => "11am", "12:00:00" => "12pm", "13:00:00" => "1pm", "14:00:00" => "2pm", "15:00:00" => "3pm", "16:00:00" => "4pm", "17:00:00" => "5pm", "18:00:00" => "6pm", "19:00:00" => "7pm", "20:00:00" => "8pm", "21:00:00" => "9pm", "22:00:00" => "10pm", "23:00:00" => "11pm", "24:00:00" => "12am"
);
$query = "SELECT * FROM tblShow, tblGuest WHERE tblShow.fk_tblGuest = tblGuest.pk_tblGuest ORDER BY showdate DESC,starttime DESC";
$result = mysql_query($query) or die("Error, the server encountered an error:".mysql_error());
while ($r = mysql_fetch_assoc($result)){
$showDateArray = explode("-",$r['showdate']);
$showDateDisplay= date('M d, Y', mktime(0,0,0,$showDateArray[1],$showDateArray[2],$showDateArray[0]));
$firstname = preg_replace('/(\\\")/',""", $r['firstname']);
$firstname = preg_replace("/(\\\')/","’", $firstname);
$lastname = preg_replace('/(\\\")/',""", $r['lastname']);
$lastname = preg_replace("/(\\\')/","’", $lastname);
$topic = preg_replace('/(\\\")/',""", $r['topic']);
$topic = preg_replace("/(\\\')/","’", $topic);
if ($r['prefix'] == NULL && $r['firstname'] == NULL && $r['lastname'] == NULL){
$guestName = "No Guest";
}
else{
$guestName = $r['prefix']." ".$r['firstname']." ".$r['lastname'];
}
echo"
<item>
<title>$guestName</title>
<description>$topic</description>";
if ($showInfo['audio'] != NULL){
$audioSize = filesize("http://www.maggiepascal.com/{$r['audio']}");
echo "\n <link>http://www.maggiepascal.com/{$r['audio']}</link>";
// <enclosure url='http://www.maggiepascal.com/{$r['audio']}' length='$audioSize' type='audio/mpeg' />
}
if ($showInfo['video'] != NULL){
$videoSize = filesize("http://www.maggiepascal.com/{$r['video2']}");
echo "\n <link>http://www.maggiepascal.com/watch?showid={$r['pk_tblShow']}</link>";
// <enclosure url='http://www.maggiepascal.com/watch?showid={$r['pk_tblShow']}' length='$videoSize' type='video/swf' />
}
if ($showInfo['video2'] != NULL){
$video2Size = filesize("http://www.maggiepascal.com/{$r['video2']}");
echo "\n <link>http://www.maggiepascal.com/watch?showid={$r['pk_tblShow']}&segment=2</link>";
}
if ($showInfo['video3'] != NULL){
$video4Size = filesize("http://www.maggiepascal.com/{$r['video4']}");
echo "\n <link>http://www.maggiepascal.com/watch?showid={$r['pk_tblShow']}&segment=3</link>";
}
if ($showInfo['video4'] != NULL){
$video3Size = filesize("http://www.maggiepascal.com/{$r['video3']}");
echo "\n <link>http://www.maggiepascal.com/watch?showid={$r['pk_tblShow']}&segment=4</link>";
}
echo "
<pubDate>$r{$showdate}</pubDate>
<time>{$r['starttime']}</time>
</item>
";
}
echo "
</channel>
</rss>
";
?>
You can visit http://www.maggiepascal.com/podcast.php to see the page and view its source.
If anyone has any ideas, I'd really appreciate the help. I expect that the problem must be something subtle...
I should also add that I'm trying to add up to 4 video links to each item. This is because the video's are often split into 3-4 segments. I'm not sure that I'm going about it the right way.
I'm using a PHP page to draw information from an SQL database and generate and RSS feed via XML. Lots of acronyms huh?
Anyway, I've pretty much finished the whole thing... it's just not working. I'm not sure why.
Essentially, when you view the xml page, none of the items show up. But when viewing the source, everything looks right. The xml seems to be generated correctly, so I'm not sure what's causing the issue.
Here's the php
<?php
include "phpdb/dbaccess.php";
header( 'Content-Type: text/xml' );
echo "<?xml version='1.0' ?>
<?xml-stylesheet href='rss.xsl' type='text/xsl' media='screen' ?>
<rss version='2.0'>
<channel>
<title>Turning the Tide</title>
<language>en-us</language>
<link>http://www.maggiepascal.com/</link>
<description>Turning the Tide</description>
<webMaster>matt@knowideaproductions.com</webMaster>
";
$timeConvert = array (
"01:00:00" => "1am", "02:00:00" => "2am", "03:00:00" => "3am", "04:00:00" => "4am", "05:00:00" => "5am", "06:00:00" => "6am", "07:00:00" => "7am", "08:00:00" => "8am", "09:00:00" => "9am", "10:00:00" => "10am", "11:00:00" => "11am", "12:00:00" => "12pm", "13:00:00" => "1pm", "14:00:00" => "2pm", "15:00:00" => "3pm", "16:00:00" => "4pm", "17:00:00" => "5pm", "18:00:00" => "6pm", "19:00:00" => "7pm", "20:00:00" => "8pm", "21:00:00" => "9pm", "22:00:00" => "10pm", "23:00:00" => "11pm", "24:00:00" => "12am"
);
$query = "SELECT * FROM tblShow, tblGuest WHERE tblShow.fk_tblGuest = tblGuest.pk_tblGuest ORDER BY showdate DESC,starttime DESC";
$result = mysql_query($query) or die("Error, the server encountered an error:".mysql_error());
while ($r = mysql_fetch_assoc($result)){
$showDateArray = explode("-",$r['showdate']);
$showDateDisplay= date('M d, Y', mktime(0,0,0,$showDateArray[1],$showDateArray[2],$showDateArray[0]));
$firstname = preg_replace('/(\\\")/',""", $r['firstname']);
$firstname = preg_replace("/(\\\')/","’", $firstname);
$lastname = preg_replace('/(\\\")/',""", $r['lastname']);
$lastname = preg_replace("/(\\\')/","’", $lastname);
$topic = preg_replace('/(\\\")/',""", $r['topic']);
$topic = preg_replace("/(\\\')/","’", $topic);
if ($r['prefix'] == NULL && $r['firstname'] == NULL && $r['lastname'] == NULL){
$guestName = "No Guest";
}
else{
$guestName = $r['prefix']." ".$r['firstname']." ".$r['lastname'];
}
echo"
<item>
<title>$guestName</title>
<description>$topic</description>";
if ($showInfo['audio'] != NULL){
$audioSize = filesize("http://www.maggiepascal.com/{$r['audio']}");
echo "\n <link>http://www.maggiepascal.com/{$r['audio']}</link>";
// <enclosure url='http://www.maggiepascal.com/{$r['audio']}' length='$audioSize' type='audio/mpeg' />
}
if ($showInfo['video'] != NULL){
$videoSize = filesize("http://www.maggiepascal.com/{$r['video2']}");
echo "\n <link>http://www.maggiepascal.com/watch?showid={$r['pk_tblShow']}</link>";
// <enclosure url='http://www.maggiepascal.com/watch?showid={$r['pk_tblShow']}' length='$videoSize' type='video/swf' />
}
if ($showInfo['video2'] != NULL){
$video2Size = filesize("http://www.maggiepascal.com/{$r['video2']}");
echo "\n <link>http://www.maggiepascal.com/watch?showid={$r['pk_tblShow']}&segment=2</link>";
}
if ($showInfo['video3'] != NULL){
$video4Size = filesize("http://www.maggiepascal.com/{$r['video4']}");
echo "\n <link>http://www.maggiepascal.com/watch?showid={$r['pk_tblShow']}&segment=3</link>";
}
if ($showInfo['video4'] != NULL){
$video3Size = filesize("http://www.maggiepascal.com/{$r['video3']}");
echo "\n <link>http://www.maggiepascal.com/watch?showid={$r['pk_tblShow']}&segment=4</link>";
}
echo "
<pubDate>$r{$showdate}</pubDate>
<time>{$r['starttime']}</time>
</item>
";
}
echo "
</channel>
</rss>
";
?>
You can visit http://www.maggiepascal.com/podcast.php to see the page and view its source.
If anyone has any ideas, I'd really appreciate the help. I expect that the problem must be something subtle...
I should also add that I'm trying to add up to 4 video links to each item. This is because the video's are often split into 3-4 segments. I'm not sure that I'm going about it the right way.