Note that there are some explanatory texts on larger screens.

plurals
  1. POUsing PHP to generate an XML file
    primarykey
    data
    text
    <p>I currently have a PHP script which when ran outputs an XML file (however as feed.php not feed.xml) I have been told to add this to my .htaccess and it should fix it:</p> <pre><code>AddType application/x-httpd-php .xml </code></pre> <p>However for some reason that isn't working.</p> <p>What I'd ideally like the script to do - when ran is to generate a feed.xml file with the output of its contents, rather than just outputting the contents on the php page.</p> <p>Here is my code:</p> <pre><code>&lt;?PHP include("../config.php"); #// Timetable Clearup Variabls $yesterday = strtotime('yesterday'); $yesterdow = date('l',$yesterday); $order = "SELECT * FROM timetable WHERE day = '$yesterdow' ORDER BY time"; $result = mysql_query($order); $yesterdayd = date('F jS, Y', time()-86400); //SET XML HEADER header('Content-type: text/xml'); //CONSTRUCT RSS FEED HEADERS $output = '&lt;rss version="2.0"&gt;'; $output .= '&lt;channel&gt;'; $output .= "&lt;title&gt;Timetable - {$yesterdayd} &lt;/title&gt;"; $output .= '&lt;description&gt;Timetable.&lt;/description&gt;'; $output .= '&lt;link&gt;http://site.com/&lt;/link&gt;'; ### $output .= '&lt;copyright&gt;Your copyright details&lt;/copyright&gt;'; while ($row = mysql_fetch_array($result)) { //BODY OF RSS FEED $output .= '&lt;item&gt;'; $output .= "&lt;description&gt;&lt;td&gt;" . htmlspecialchars($row['username']) . "&lt;/td&gt;&lt;td&gt;" . htmlspecialchars($row['time']) . "&lt;/td&gt;&lt;/description&gt;"; $output .= '&lt;/item&gt; '; } //CLOSE RSS FEED $output .= '&lt;/channel&gt;'; $output .= '&lt;/rss&gt;'; //SEND COMPLETE RSS FEED TO BROWSER echo($output); ?&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload