473,503 Members | 11,783 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

create rss xml

I'm currently working on creating the xml feed since I had data ready
in my database after web data extraction. However, it has errors for
this line:

<xml version="1.0" encoding="ISO-8859-1">

I was unable to solve this.

<html>
<head>
<title>MMU RSS FEED</title>
</head>
<body>

header("Content-type: application/xml");
<xml version="1.0" encoding="ISO-8859-1">

<rss version ="2.0">
<channel>
<title>MMU RSS FEED Today: <?php echo date("D, d-M-Y H:i:s")?></
title>
<link>http://bulletin.mmu.edu.my/</link>
<description>MMU RSS FEED</description>
<ttl>60<ttl>

<?php

//connect to database
$db = mysql_connect("localhost", "root", "") or die(mysql_error());
mysql_select_db("bulletin", $db) or die(mysql_error());

$day = date("Y-n-j");

//select queries
$sql = "SELECT * FROM `bul_data` WHERE `DATE` LIKE '{$day}%' ORDER by
`DEPARTMENT`";
echo "sql=".$sql;

$res = mysql_query($sql) or die(mysql_error());

if(mysql_num_rows($res)>0)
{

while($row=mysql_fetch_assoc($res))
{
$date = $row['DATE'];
$title = $row['TITLE'];
$department = $row['DEPARTMENT'];
$link = $row['LINK'];

//output to browser

echo "<item>";
echo "<title>$title</title>";
echo "<category>$department</category>";
echo "<link><a href=\"$link\">$link</a></link>";
echo "</item>";
}

echo "</table>";

}

?>

</channel>
</rss>
</body>
</html>

Feb 4 '07 #1
11 1979
Rik
caine <th*********@gmail.comwrote:
I'm currently working on creating the xml feed since I had data ready
in my database after web data extraction. However, it has errors for
this line:

<xml version="1.0" encoding="ISO-8859-1">
<?xml .... ?>
--
Rik Wasmus
Feb 4 '07 #2
On Sun, 04 Feb 2007 06:41:16 -0800, Rik <lu************@hotmail.comwrote:
caine <th*********@gmail.comwrote:
>I'm currently working on creating the xml feed since I had data ready
in my database after web data extraction. However, it has errors for
this line:

<xml version="1.0" encoding="ISO-8859-1">

<?xml .... ?>
Since it's within a PHP document, you'd have to echo it, in case short
tags start trying to process the contents of the declaration:

echo '<?xml ... ?>';

--
Curtis, http://dyersweb.com
Feb 5 '07 #3
<?xml .... ?>
echo '<?xml ... ?>';
Both these don't work as well. I tried with <?xml version="1.0"
standalone="yes"?also failed.

I'm saving this as .php file. Or could it be problem with setting or
anything else?
Caine

Feb 5 '07 #4
Rik
caine <th*********@gmail.comwrote:
<?xml .... ?>
>echo '<?xml ... ?>';

Both these don't work as well. I tried with <?xml version="1.0"
standalone="yes"?also failed.

I'm saving this as .php file. Or could it be problem with setting or
anything else?
Disable short_open_tags.

--
Rik Wasmus
Feb 5 '07 #5
On Sun, 04 Feb 2007 23:53:57 -0800, caine <th*********@gmail.comwrote:
<?xml .... ?>
>echo '<?xml ... ?>';

Both these don't work as well. I tried with <?xml version="1.0"
standalone="yes"?also failed.

I'm saving this as .php file. Or could it be problem with setting or
anything else?
Caine
In what way is it not working? PHP error? XML parse error? If so, post the
exact error you're getting.

Also, maybe releated, on the line with "<title>", you have an echo
statement in your document that isn't terminated by a semi-colon.

--
Curtis, http://dyersweb.com
Feb 5 '07 #6
Caine,

Some interspaced comments. Probably not all of the errors, but it
should give you a start.

caine wrote:
I'm currently working on creating the xml feed since I had data ready
in my database after web data extraction. However, it has errors for
this line:

<xml version="1.0" encoding="ISO-8859-1">

I was unable to solve this.

<html>
<head>
<title>MMU RSS FEED</title>
</head>
<body>

header("Content-type: application/xml");
Is this supposed to be a PHP statement? If so, it won't work here.

It must be within <?php ... ?tags, and must appear before any output
(including the <htmltag, any whitespace, etc.).
>
<xml version="1.0" encoding="ISO-8859-1">
Should be <?xml ...?>.
<rss version ="2.0">
<channel>
<title>MMU RSS FEED Today: <?php echo date("D, d-M-Y H:i:s")?></
title>
Needs semicolon at the end of the PHP statement.
<link>http://bulletin.mmu.edu.my/</link>
<description>MMU RSS FEED</description>
<ttl>60<ttl>
Should be <ttl>60</ttl>
<?php

//connect to database
$db = mysql_connect("localhost", "root", "") or die(mysql_error());
VERY BAD idea to connect with "root", especially with no password.
Major security vulnerability.
mysql_select_db("bulletin", $db) or die(mysql_error());

$day = date("Y-n-j");

//select queries
$sql = "SELECT * FROM `bul_data` WHERE `DATE` LIKE '{$day}%' ORDER by
`DEPARTMENT`";
echo "sql=".$sql;

$res = mysql_query($sql) or die(mysql_error());

if(mysql_num_rows($res)>0)
{

while($row=mysql_fetch_assoc($res))
{
$date = $row['DATE'];
$title = $row['TITLE'];
$department = $row['DEPARTMENT'];
$link = $row['LINK'];

//output to browser

echo "<item>";
echo "<title>$title</title>";
echo "<category>$department</category>";
echo "<link><a href=\"$link\">$link</a></link>";
echo "</item>";
}

echo "</table>";

}

?>

</channel>
</rss>
</body>
</html>

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Feb 5 '07 #7
The error statement i got is :

Parse error: parse error, expecting `','' or `';'' in C:\Program Files
\xampp\htdocs\phprss.php on line 12

for this line : echo "<?xml version="1.0" standalone="yes"?>";
doesn't work.

I had updated these lines:

<?php

header ("Content-Type: text/xml; charset=iso-8859-1");
echo "<?xml version="1.0" standalone="yes"?>";

echo "<rss version ="2.0">";
echo "<channel>";
echo "<title>MMU RSS FEED Today: date("D, d-M-Y H:i:s")</title>";
echo "<link>http://bulletin.mmu.edu.my/</link>";
echo "<description>MMU RSS FEED</description>";

Feb 8 '07 #8
caine wrote:
The error statement i got is :

Parse error: parse error, expecting `','' or `';'' in C:\Program Files
\xampp\htdocs\phprss.php on line 12

for this line : echo "<?xml version="1.0" standalone="yes"?>";
doesn't work.
echo "<?xml version=\"1.0\" standalone=\"yes\"?>";

Or

echo '<?xml version="1.0" standalone="yes"?>'
;
I had updated these lines:

<?php

header ("Content-Type: text/xml; charset=iso-8859-1");
echo "<?xml version="1.0" standalone="yes"?>";

echo "<rss version ="2.0">";
echo "<channel>";
echo "<title>MMU RSS FEED Today: date("D, d-M-Y H:i:s")</title>";
echo "<link>http://bulletin.mmu.edu.my/</link>";
echo "<description>MMU RSS FEED</description>";

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Feb 8 '07 #9
echo "<?xmlversion=\"1.0\" standalone=\"yes\"?>";
>
Or

echo '<?xmlversion="1.0" standalone="yes"?>'
Not working again. Got the error statement like this:

XML Parsing Error: xml declaration not at start of external entity
Location: http://localhost/phprss.php
Line Number 7, Column 1: <?xml version="1.0" standalone="yes"?>
^

Feb 9 '07 #10
caine wrote:
>echo "<?xmlversion=\"1.0\" standalone=\"yes\"?>";

Or

echo '<?xmlversion="1.0" standalone="yes"?>'

Not working again. Got the error statement like this:

XML Parsing Error: xml declaration not at start of external entity
Location: http://localhost/phprss.php
Line Number 7, Column 1: <?xml version="1.0" standalone="yes"?>
^
Did you look at the error message? It says this isn't at the start. It
even tells you it's on line 7.

Check your XML spec. This must be the first thing in it.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Feb 9 '07 #11
On Feb 9, 8:56 am, "caine" <thensiuj...@gmail.comwrote:
echo "<?xmlversion=\"1.0\" standalone=\"yes\"?>";
Or
echo '<?xmlversion="1.0" standalone="yes"?>'

Not working again. Got the error statement like this:

XML Parsing Error: xml declaration not at start of external entity
Location:http://localhost/phprss.php
Line Number 7, Column 1: <?xml version="1.0" standalone="yes"?>
^
-------------------
I will suggest these changes in your script:

First of all you will change <xml ... to <?xml ... >.
Second may be short tag will create problem.
So for above line do something like this: echo '<?xml ....>';
and you are using header() below lot of html. Use header at top or use
ob_start(); at top.
I think you do not need <html>, <head>, <title>, <body>, etc. all
above header() line. So remove all these from bottom of the file.

Feb 10 '07 #12

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
8821
by: dog | last post by:
I've seen plenty of articles on this topic but none of them have been able to solve my problem. I am working with an Access 97 database on an NT4.0 machine, which has many Access reports. I...
4
4382
by: I_AM_DON_AND_YOU? | last post by:
There is one more problem I am facing but didn't get the solution. In my Setup Program I am not been able to create 2 things (when the program is intalled on the client machine ) : (1) create...
10
8769
by: Zack Sessions | last post by:
Has anyone tried to create a SQL7 view using the CREATE VIEW command and ADO.NET? If so, is there a trick in trapping a SQL error when trying to create the view? I have a VB.NET app that, amoung...
9
8248
by: Peter | last post by:
Hello£¬everyone, My program will collect a testing machine's data ,save the data and deal with the data everyday. I want to use vb.net to create database, add and delete tables or modify the...
37
3245
by: Steven Bethard | last post by:
The PEP below should be mostly self explanatory. I'll try to keep the most updated versions available at: http://ucsu.colorado.edu/~bethard/py/pep_create_statement.txt...
18
2682
by: Steven Bethard | last post by:
I've updated the PEP based on a number of comments on comp.lang.python. The most updated versions are still at: http://ucsu.colorado.edu/~bethard/py/pep_create_statement.txt...
5
4857
by: Michael | last post by:
Hello, I've created an ASP web page where users in our organization can create Active Directory computer accounts. The web page is running on a Server 2003 SP1 IIS 6 installation. The...
8
20327
by: barb | last post by:
So that the world at large benefits from our efforts, here is one fully documented way to use Windows Irfanview freeware to create thumbnail web galleries (http://www.irfanview.com). STEP 1:...
2
22559
by: masri999 | last post by:
I have a requirement in SQL 2005 in Development database 1. Schema dbo owns all objects (tables,views,SPs,UDFs etc) . 2. Only DBA's ( who are database owners ) can create, alter tables ....
4
3728
by: JohnnyDeep | last post by:
I am trying to create a store proc that contain a create index with the cluster option and I receive DB21034E The command was processed as an SQL statement because it was not a valid Command...
0
7070
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7316
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6976
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7449
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
4993
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3160
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1495
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
729
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
372
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.