Solved

Create RSS-feed From Access Database

Posted on 2009-07-10
35
894 Views
Last Modified: 2013-11-19
i have a access db
ID:
PracticeName:
PCT:
Practice_Telephone_Number:
Contact_Name:
Direct_Line_Number:
Fax_Number:
email_address:
Surgery_Address_including_Postcode:
Brief_description_of_Pratice:
Number_of_Patients:
Number_of_GPs:
Practice_Computer_System:
description_of_Post:
Timestamp:
Remote_computer_name:
User_name:
Browser_type:
Timestamp1:


what is the best way to get top 8 in to a rss feed...... not a asp.net
0
Comment
Question by:James Murrell
  • 17
  • 12
  • 4
  • +1
35 Comments
 
LVL 30

Expert Comment

by:renazonse
Comment Utility
So you're trying to create the RSS XML without using ASP? If you're using PHP is it on a Linux server? If you're using Linux you can get the ODBC drivers to connect to the database here: http://www.openlinksw.com/

If you're using a Windows web server you just need to create the ODBC connection for the PHP to read the Access database and generate the XML for the feed. This page explains how:
http://www.ibm.com/developerworks/library/x-phprss/

Here's an example of the generated XML file:
<?xml version="1.0" encoding="UTF-8"?>

<rss version="2.0">

  <channel>

    <title>Your RSS Feed</title>

    <link>http://feedlink.com</link>

    <description>Practices</description>

    <language>en-us</language>

    <pubDate>Tue, 10 Jun 2009 04:00:00 GMT</pubDate>

    <lastBuildDate>Tue, 10 Jun 2009 09:41:01 GMT</lastBuildDate>

  

    <item>

      <title>Practice Name</title>

      <link>http://linkifany.com</link>

      <description>

	 	ID:

		PracticeName:

		PCT:

		Practice_Telephone_Number:

		Contact_Name:

		Direct_Line_Number:

		Fax_Number:

		email_address:

	  </description>

      <pubDate>Tue, 03 Jun 2009 09:39:21 GMT</pubDate>

    </item>

  </channel>

</rss>

Open in new window

0
 
LVL 31

Author Comment

by:James Murrell
Comment Utility
with asp is ok but not asp.net... it is a windows iis 6 server
0
 
LVL 30

Expert Comment

by:renazonse
Comment Utility
I'm not an asp guy but the same format above applies. The article explains how to query the database using ASP and you'll need to write the code that echos out the content of the XML for the feed.

http://www.haneng.com/lessons_17.asp
0
 
LVL 31

Author Comment

by:James Murrell
Comment Utility
i havew manage to get this far

but nothing appears


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

<% Response.Buffer = true

   Response.ContentType = "text/xml"

   

Function ApplyXMLFormatting(strInput)

  strInput = Replace(strInput,"&", "&amp;")

  strInput = Replace(strInput,"'", "'")

  strInput = Replace(strInput,"""", "&quot;")

  strInput = Replace(strInput, ">", "&gt;")

  strInput = Replace(strInput,"<","&lt;")

  

  ApplyXMLFormatting = strInput

End Function   

    %>
 

<rss version="2.0">

  <channel>

    <title>Recent Posts on xxxxxxxxx.com</title>

    <link>http://www.xxxxxxxxxxx.com/</link>

    <description>xxx.com is a site wxxxxxxxxxxxxxxs!</description>

    <language>en-us</language>

    <copyright>Copyright x. 

       All Rights Reserved.</copyright>

    <lastBuildDate><%=Now()%></lastBuildDate>

    <ttl>20</ttl>

<%

  'Dim objConn

 Set objConn = Server.CreateObject("ADODB.Connection")

  'objConn.ConnectionString = Application("practice_registration.mdb")

  objConn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _

Server.MapPath ("practice_registration.mdb") & ";"

 objConn.Open

    

  Dim objRS, strSQL, strDesc 

  strSQL ="SELECT Results.PracticeName, Results.Practice_Telephone_Number, Results.description_of_Post, Results.Timestamp FROM Results;"

  Set objRS = objConn.Execute(strSQL)  
 

  Do While Not objRS.EOF

    strDesc = "<b>Message by " & objRS("PracticeName") & " on " & _

             objRS("Timestamp") & " EST</b><br>" & _

             objRS("description_of_Post").Value %>

    <item>

      <title><%=ApplyXMLFormatting(objRS("PracticeName").Value)%> 

         (<%=ApplyXMLFormatting(objRS("Timestamp").Value)%>)

      </title>

      <link>http://www.xxxxxxx.com/forum/showMessage.asp?F=

           <%=objRS("ForumID")%>&amp;P=1&amp;M=<%=objRS("MsgID")%></link><description><%=ApplyXMLFormatting(strDesc)%></description><datePosted><%=ApplyXMLFormatting(objRS("Timestamp"))%></datePosted></item><%

    objRS.MoveNext

  Loop

  

  objRS.Close

  Set objRS = Nothing
 

  objConn.Close

  Set objRS = Nothing

  Set objConn = Nothing

%></channel></rss>

Open in new window

0
 
LVL 30

Expert Comment

by:renazonse
Comment Utility
Are you getting any kind of errors?
0
 
LVL 30

Expert Comment

by:renazonse
Comment Utility
Somebody with a heavier background in this should be able to help you from here.
0
 
LVL 31

Author Comment

by:James Murrell
Comment Utility
no errors just  as below and they is 25 records in the db

My Page

RSS content is displayed below:


--------------------------------------------------------------------------------
http://www.xxxxxxxxxxx.com/ xxxxxxx.com is xxxxxxxxx! en-us Copyright 200xxxxxxxx. All Rights Reserved. 12/07/2009 19:26:06 20
0
 
LVL 25

Expert Comment

by:kevp75
Comment Utility
change:
strSQL ="SELECT Results.PracticeName, Results.Practice_Telephone_Number, Results.description_of_Post, Results.Timestamp FROM Results;"


to:
strSQL ="SELECT TOP 8 Results.PracticeName, Results.Practice_Telephone_Number, Results.description_of_Post, Results.Timestamp FROM Results;"
0
 
LVL 31

Author Comment

by:James Murrell
Comment Utility
My Page

RSS content is displayed below:


--------------------------------------------------------------------------------
http://www.xxxxxxxxxxx.com/ xxxxxxx.com is xxxxxxxxx! en-us Copyright 200xxxxxxxx. All Rights Reserved. 12/07/2009 19:42:24 20
0
 
LVL 31

Author Comment

by:James Murrell
Comment Utility
forgot to add : still the same....

0
 
LVL 25

Expert Comment

by:kevp75
Comment Utility
can you send us a real link to it?  Did you try what I posted to limit them?
0
 
LVL 31

Author Comment

by:James Murrell
Comment Utility
0
 
LVL 25

Expert Comment

by:kevp75
Comment Utility
Try this, exactly how it is posted here (with the exception of adding the forumID, and messageID to your query):


<%

Response.Buffer = true

Response.ContentType = "text/xml"

Write("<rss version=""2.0"">" & VbCrLf)

Write("<channel>" & VBCrLf)

Write("	<title>Recent Posts on xxxxxxxxx.com</title>" & VBCrLf)

Write("	<link>http://www.xxxxxxxxxxx.com/</link>" & VBCrLf)

Write("	<description>xxx.com is a site wxxxxxxxxxxxxxxs!</description>" & VBCrLf)

Write("	<language>en-us</language>" & VBCrLf)

Write("	<copyright>Copyright x. All Rights Reserved.</copyright>" & VBCrLf)

Write("	<lastBuildDate><%=Now()%></lastBuildDate>" & VBCrLf)

Write("	<ttl>20</ttl>" & VBCrLf)

Dim objConn, objRS, strSQL, strDesc

'objConn.ConnectionString = Application("practice_registration.mdb")

Set objConn = Server.CreateObject("ADODB.Connection")

	objConn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath ("practice_registration.mdb") & ";"

	objConn.Open

		strSQL ="SELECT Top 8 PracticeName, Practice_Telephone_Number, description_of_Post, Timestamp, forumID, messageID FROM Results" 'get the message and forum ID in this...

		Set objRS = objConn.Execute(strSQL) 

			If Not(objRS.Eof) Then

				tmpArr = objRS.GetRows()

			End If

		Set objRS = Nothing 

	objConn.Close

Set objConn = Nothing

If IsArray(tmpArr) Then

	For i = 0 To UBound(tmpArr)

		Write("	<item>" & VbCrLf)

		Write("		<guid isPermaLink=""false"">MESSAGE_" & tmpArr(5, i) & "</guid>" & VbCrLf)

		Write("		<title>" & ApplyXMLFormatting(tmpArr(0, i)) & " (" & ApplyXMLFormatting(tmpArr(3, i)) & ")</title>" & VbCrLf)

		Write("		<link>http://www.xxxxxxx.com/forum/showMessage.asp?F=" & tmpArr(4, i) & "&amp;M=" & tmpArr(5, i) & "</link>" & VbCrLf)

		Write("			<description>" & VbCrLf)

		Write("				<![CDATA[" & VbCrLf)

		Write("					<strong>Message by " & tmpArr(0, i) & " on " & tmpArr(3, i) & " EST</strong><br />" & tmpArr(2, i) & VbCrLf)

		Write("				]]>" & VbCrLf)

		Write("			</description>" & VbCrLf)

		Write("			<pubDate>" & tmpArr(2, i) & "</pubDate>" & VbCrLf)

		Write("	</item>" & VbCrLf)

	Next : i = Null

	Erase tmpArr

End If

Write("</channel>" & VbCrLf)

Function ApplyXMLFormatting(ByVal strInput)

	strInput = Replace(strInput,"&", "&amp;")

	strInput = Replace(strInput,"'", "'")

	strInput = Replace(strInput,"""", "&quot;")

	strInput = Replace(strInput, ">", "&gt;")

	strInput = Replace(strInput,"<","&lt;")

	ApplyXMLFormatting = strInput

End Function   

Sub Write(ByVal strString)

	Response.Write(strString)

End Sub

%>

Open in new window

0
 
LVL 31

Author Comment

by:James Murrell
Comment Utility
Microsoft VBScript compilation error '800a0409'

Unterminated string constant

/RSS2HTML.asp, line 11

Write(" <%=Now()
-------------------------------^
0
 
LVL 25

Expert Comment

by:kevp75
Comment Utility
p.s.   Your first link, is invalid because it is not an XML only document

your second link is not valid because it contains an error:

Invalid use of Null: 'Replace'
/RSS2HTML.asp, line 6

try what I posted, including the changes I suggested
0
 
LVL 25

Expert Comment

by:kevp75
Comment Utility
Ok...change that line to:

Write(" <lastBuildDate>" & Now() & "</lastBuildDate>" & VBCrLf)
0
 
LVL 25

Expert Comment

by:kevp75
Comment Utility
also, I believe it's supposed to be <pubDate></pubDate> and not <lastBuildDate></lastBuildDate>
0
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 25

Expert Comment

by:kevp75
Comment Utility
aye...   it is... try this:


<%

Response.Buffer = true

Response.ContentType = "text/xml"

Write("<rss version=""2.0"">" & VbCrLf)

Write("<channel>" & VBCrLf)

Write("	<title>Recent Posts on xxxxxxxxx.com</title>" & VBCrLf)

Write("	<link>http://www.xxxxxxxxxxx.com/</link>" & VBCrLf)

Write("	<description>xxx.com is a site wxxxxxxxxxxxxxxs!</description>" & VBCrLf)

Write("	<language>en-us</language>" & VBCrLf)

Write("	<copyright>Copyright x. All Rights Reserved.</copyright>" & VBCrLf)

Write("	<pubDate>" & Now() & "</pubDate>" & VBCrLf)

Write("	<ttl>20</ttl>" & VBCrLf)

Dim objConn, objRS, strSQL, strDesc

'objConn.ConnectionString = Application("practice_registration.mdb")

Set objConn = Server.CreateObject("ADODB.Connection")

	objConn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath ("practice_registration.mdb") & ";"

	objConn.Open

		strSQL ="SELECT Top 8 PracticeName, Practice_Telephone_Number, description_of_Post, Timestamp, forumID, messageID FROM Results" 'get the message and forum ID in this...

		Set objRS = objConn.Execute(strSQL) 

			If Not(objRS.Eof) Then

				tmpArr = objRS.GetRows()

			End If

		Set objRS = Nothing 

	objConn.Close

Set objConn = Nothing

If IsArray(tmpArr) Then

	For i = 0 To UBound(tmpArr)

		Write("	<item>" & VbCrLf)

		Write("		<guid isPermaLink=""false"">MESSAGE_" & tmpArr(5, i) & "</guid>" & VbCrLf)

		Write("		<title>" & ApplyXMLFormatting(tmpArr(0, i)) & " (" & ApplyXMLFormatting(tmpArr(3, i)) & ")</title>" & VbCrLf)

		Write("		<link>http://www.xxxxxxx.com/forum/showMessage.asp?F=" & tmpArr(4, i) & "&amp;M=" & tmpArr(5, i) & "</link>" & VbCrLf)

		Write("			<description>" & VbCrLf)

		Write("				<![CDATA[" & VbCrLf)

		Write("					<strong>Message by " & tmpArr(0, i) & " on " & tmpArr(3, i) & " EST</strong><br />" & tmpArr(2, i) & VbCrLf)

		Write("				]]>" & VbCrLf)

		Write("			</description>" & VbCrLf)

		Write("			<pubDate>" & tmpArr(2, i) & "</pubDate>" & VbCrLf)

		Write("	</item>" & VbCrLf)

	Next : i = Null

	Erase tmpArr

End If

Write("</channel>" & VbCrLf)

Function ApplyXMLFormatting(ByVal strInput)

	strInput = Replace(strInput,"&", "&amp;")

	strInput = Replace(strInput,"'", "'")

	strInput = Replace(strInput,"""", "&quot;")

	strInput = Replace(strInput, ">", "&gt;")

	strInput = Replace(strInput,"<","&lt;")

	ApplyXMLFormatting = strInput

End Function   

Sub Write(ByVal strString)

	Response.Write(strString)

End Sub

%>

Open in new window

0
 
LVL 31

Author Comment

by:James Murrell
Comment Utility
using above code

This page contains the following errors:

error on line 10 at column 17: AttValue: " or ' expected
Below is a rendering of the page up to the first error.

Recent Posts on xxxxxxxxx.com http://www.xxxxxxxxxxx.com/ xxx.com is a site wxxxxxxxxxxxxxxs! en-us Copyright x. All Rights Reserved. 12/07/2009 20:40:35 20
0
 
LVL 25

Expert Comment

by:kevp75
Comment Utility
on what link?
0
 
LVL 25

Expert Comment

by:kevp75
Comment Utility
I'm now getting this error on the second link:

No value given for one or more required parameters.

post your code as it is now
0
 
LVL 31

Author Comment

by:James Murrell
Comment Utility
as you posted
<%

Response.Buffer = true

Response.ContentType = "text/xml"

Write("<rss version=""2.0"">" & VbCrLf)

Write("<channel>" & VBCrLf)

Write(" <title>Recent Posts on xxxxxxxxx.com</title>" & VBCrLf)

Write(" <link>http://www.xxxxxxxxxxx.com/</link>" & VBCrLf)

Write(" <description>xxx.com is a site wxxxxxxxxxxxxxxs!</description>" & VBCrLf)

Write(" <language>en-us</language>" & VBCrLf)

Write(" <copyright>Copyright x. All Rights Reserved.</copyright>" & VBCrLf)

Write(" <pubDate>" & Now() & "</pubDate>" & VBCrLf)

Write(" <ttl>20</ttl>" & VBCrLf)

Dim objConn, objRS, strSQL, strDesc

'objConn.ConnectionString = Application("practice_registration.mdb")

Set objConn = Server.CreateObject("ADODB.Connection")

        objConn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath ("practice_registration.mdb") & ";"

        objConn.Open

                strSQL ="SELECT Top 8 PracticeName, Practice_Telephone_Number, description_of_Post, Timestamp, forumID, messageID FROM Results" 'get the message and forum ID in this...

                Set objRS = objConn.Execute(strSQL) 

                        If Not(objRS.Eof) Then

                                tmpArr = objRS.GetRows()

                        End If

                Set objRS = Nothing 

        objConn.Close

Set objConn = Nothing

If IsArray(tmpArr) Then

        For i = 0 To UBound(tmpArr)

                Write(" <item>" & VbCrLf)

                Write("         <guid isPermaLink=""false"">MESSAGE_" & tmpArr(5, i) & "</guid>" & VbCrLf)

                Write("         <title>" & ApplyXMLFormatting(tmpArr(0, i)) & " (" & ApplyXMLFormatting(tmpArr(3, i)) & ")</title>" & VbCrLf)

                Write("         <link>http://www.xxxxxxx.com/forum/showMessage.asp?F=" & tmpArr(4, i) & "&amp;M=" & tmpArr(5, i) & "</link>" & VbCrLf)

                Write("                 <description>" & VbCrLf)

                Write("                         <![CDATA[" & VbCrLf)

                Write("                                 <strong>Message by " & tmpArr(0, i) & " on " & tmpArr(3, i) & " EST</strong><br />" & tmpArr(2, i) & VbCrLf)

                Write("                         ]]>" & VbCrLf)

                Write("                 </description>" & VbCrLf)

                Write("                 <pubDate>" & tmpArr(2, i) & "</pubDate>" & VbCrLf)

                Write(" </item>" & VbCrLf)

        Next : i = Null

        Erase tmpArr

End If

Write("</channel>" & VbCrLf)

Function ApplyXMLFormatting(ByVal strInput)

        strInput = Replace(strInput,"&", "&amp;")

        strInput = Replace(strInput,"'", "'")

        strInput = Replace(strInput,"""", "&quot;")

        strInput = Replace(strInput, ">", "&gt;")

        strInput = Replace(strInput,"<","&lt;")

        ApplyXMLFormatting = strInput

End Function   

Sub Write(ByVal strString)

        Response.Write(strString)

End Sub

%>

Open in new window

0
 
LVL 25

Expert Comment

by:kevp75
Comment Utility
Line 18...  did you do as I asked?

strSQL ="SELECT Top 8 PracticeName, Practice_Telephone_Number, description_of_Post, Timestamp, forumID, messageID FROM Results" 'get the message and forum ID in this...



change forumID, and messageID to what they are in the table Results
0
 
LVL 25

Expert Comment

by:kevp75
Comment Utility
post the structure for Resultsis that the structure for the table 'Results' in your main question?
0
 

Expert Comment

by:1500
Comment Utility
I have no idea what to do here.  I just need to open a QRP file.  I see no help here.

1500
0
 
LVL 25

Expert Comment

by:kevp75
Comment Utility
Try this on for size:


<%

Response.Buffer = true

Response.ContentType = "text/xml"

Write("<rss version=""2.0"">" & VbCrLf)

Write("<channel>" & VBCrLf)

Write("	<title>Recent Posts on xxxxxxxxx.com</title>" & VBCrLf)

Write("	<link>http://www.xxxxxxxxxxx.com/</link>" & VBCrLf)

Write("	<description>xxx.com is a site wxxxxxxxxxxxxxxs!</description>" & VBCrLf)

Write("	<language>en-us</language>" & VBCrLf)

Write("	<copyright>Copyright x. All Rights Reserved.</copyright>" & VBCrLf)

Write("	<pubDate>" & Now() & "</pubDate>" & VBCrLf)

Write("	<ttl>20</ttl>" & VBCrLf)

Dim objConn, objRS, strSQL, strDesc

'objConn.ConnectionString = Application("practice_registration.mdb")

Set objConn = Server.CreateObject("ADODB.Connection")

	objConn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath ("practice_registration.mdb") & ";"

	objConn.Open

		strSQL ="SELECT Top 8 PracticeName, Practice_Telephone_Number, description_of_Post, Timestamp, ID FROM Results"

		Set objRS = objConn.Execute(strSQL) 

			If Not(objRS.Eof) Then

				tmpArr = objRS.GetRows()

			End If

		Set objRS = Nothing 

	objConn.Close

Set objConn = Nothing

If IsArray(tmpArr) Then

	For i = 0 To UBound(tmpArr)

		Write("	<item>" & VbCrLf)

		Write("		<guid isPermaLink=""false"">MESSAGE_" & tmpArr(5, i) & "</guid>" & VbCrLf)

		Write("		<title>" & ApplyXMLFormatting(tmpArr(0, i)) & " (" & ApplyXMLFormatting(tmpArr(3, i)) & ")</title>" & VbCrLf)

		Write("		<link>http://www.xxxxxxx.com/forum/showMessage.asp?M=" & tmpArr(4, i) & "</link>" & VbCrLf)

		Write("			<description>" & VbCrLf)

		Write("				<![CDATA[" & VbCrLf)

		Write("					<strong>Message by " & tmpArr(0, i) & " on " & tmpArr(3, i) & " EST</strong><br />" & tmpArr(2, i) & VbCrLf)

		Write("				]]>" & VbCrLf)

		Write("			</description>" & VbCrLf)

		Write("			<pubDate>" & tmpArr(2, i) & "</pubDate>" & VbCrLf)

		Write("	</item>" & VbCrLf)

	Next : i = Null

	Erase tmpArr

End If

Write("</channel>" & VbCrLf)

Function ApplyXMLFormatting(ByVal strInput)

	strInput = Replace(strInput,"&", "&amp;")

	strInput = Replace(strInput,"'", "'")

	strInput = Replace(strInput,"""", "&quot;")

	strInput = Replace(strInput, ">", "&gt;")

	strInput = Replace(strInput,"<","&lt;")

	ApplyXMLFormatting = strInput

End Function   

Sub Write(ByVal strString)

	Response.Write(strString)

End Sub

%>

Open in new window

0
 
LVL 25

Expert Comment

by:kevp75
Comment Utility
@1500....   what?
0
 

Expert Comment

by:1500
Comment Utility
I recieived an e-mail with a QRP file attached.  How do I open it?
0
 
LVL 31

Author Comment

by:James Murrell
Comment Utility
whoops new code - same error


<%

Response.Buffer = true

Response.ContentType = "text/xml"

Write("<rss version=""2.0"">" & VbCrLf)

Write("<channel>" & VBCrLf)

Write(" <title>Recent Posts on xxxxxxxxx.com</title>" & VBCrLf)

Write(" <link>http://www.xxxxxxxxxxx.com/</link>" & VBCrLf)

Write(" <description>xxx.com is a site wxxxxxxxxxxxxxxs!</description>" & VBCrLf)

Write(" <language>en-us</language>" & VBCrLf)

Write(" <copyright>Copyright x. All Rights Reserved.</copyright>" & VBCrLf)

Write(" <pubDate>" & Now() & "</pubDate>" & VBCrLf)

Write(" <ttl>20</ttl>" & VBCrLf)

Dim objConn, objRS, strSQL, strDesc

'objConn.ConnectionString = Application("practice_registration.mdb")

Set objConn = Server.CreateObject("ADODB.Connection")

        objConn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath ("practice_registration.mdb") & ";"

        objConn.Open

                strSQL ="SELECT Top 8 PracticeName, Practice_Telephone_Number, description_of_Post, Timestamp,PCT,  ID FROM Results" 'get the message and forum ID in this...

                Set objRS = objConn.Execute(strSQL) 

                        If Not(objRS.Eof) Then

                                tmpArr = objRS.GetRows()

                        End If

                Set objRS = Nothing 

        objConn.Close

Set objConn = Nothing

If IsArray(tmpArr) Then

        For i = 0 To UBound(tmpArr)

                Write(" <item>" & VbCrLf)

                Write("         <guid isPermaLink=""false"">MESSAGE_" & tmpArr(5, i) & "</guid>" & VbCrLf)

                Write("         <title>" & ApplyXMLFormatting(tmpArr(0, i)) & " (" & ApplyXMLFormatting(tmpArr(3, i)) & ")</title>" & VbCrLf)

                Write("         <link>http://www.xxxxxxx.com/forum/showMessage.asp?F=" & tmpArr(4, i) & "&amp;M=" & tmpArr(5, i) & "</link>" & VbCrLf)

                Write("                 <description>" & VbCrLf)

                Write("                         <![CDATA[" & VbCrLf)

                Write("                                 <strong>Message by " & tmpArr(0, i) & " on " & tmpArr(3, i) & " EST</strong><br />" & tmpArr(2, i) & VbCrLf)

                Write("                         ]]>" & VbCrLf)

                Write("                 </description>" & VbCrLf)

                Write("                 <pubDate>" & tmpArr(2, i) & "</pubDate>" & VbCrLf)

                Write(" </item>" & VbCrLf)

        Next : i = Null

        Erase tmpArr

End If

Write("</channel>" & VbCrLf)

Function ApplyXMLFormatting(ByVal strInput)

        strInput = Replace(strInput,"&", "&amp;")

        strInput = Replace(strInput,"'", "'")

        strInput = Replace(strInput,"""", "&quot;")

        strInput = Replace(strInput, ">", "&gt;")

        strInput = Replace(strInput,"<","&lt;")

        ApplyXMLFormatting = strInput

End Function   

Sub Write(ByVal strString)

        Response.Write(strString)

End Sub

%>

Open in new window

ee.txt
0
 
LVL 25

Expert Comment

by:kevp75
Comment Utility
can you upload an example database with some dummy data in it?

@1500...  ask in a new question.  Please do not invade somebody else's question.
0
 
LVL 31

Author Comment

by:James Murrell
Comment Utility
0
 
LVL 25

Accepted Solution

by:
kevp75 earned 500 total points
Comment Utility
Ok.

The following code works @: http://manager.zipcm.com/temp.asp

please note...  change the path to your database

<%

Response.Buffer = true

Response.ContentType = "text/xml"

Write("<rss version=""2.0"">" & VbCrLf)

Write("	<channel>" & VBCrLf)

Write("		<title>Recent Posts on xxxxxxxxx.com</title>" & VBCrLf)

Write("		<link>http://www.xxxxxxxxxxx.com/</link>" & VBCrLf)

Write("		<description>xxx.com is a site wxxxxxxxxxxxxxxs!</description>" & VBCrLf)

Write("		<language>en-us</language>" & VBCrLf)

Write("		<copyright>Copyright x. All Rights Reserved.</copyright>" & VBCrLf)

Write("		<pubDate>" & Now() & "</pubDate>" & VBCrLf)

Write("		<ttl>20</ttl>" & VBCrLf)

Dim objConn, objRS, strSQL, strDesc

'objConn.ConnectionString = Application("practice_registration.mdb")

Set objConn = Server.CreateObject("ADODB.Connection")

	objConn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath ("/practice_registration.mdb") & ";"

	objConn.Open

		strSQL ="SELECT Top 8 PracticeName, Practice_Telephone_Number, description_of_Post, Timestamp, ID, PCT FROM Results"

		Set objRS = objConn.Execute(strSQL) 

			If Not(objRS.Eof) Then

				tmpArr = objRS.GetRows()

			End If

		Set objRS = Nothing 

	objConn.Close

Set objConn = Nothing

If IsArray(tmpArr) Then

	For i = 0 To UBound(tmpArr)

		Write("		<item>" & VbCrLf)

		Write("			<guid isPermaLink=""false"">MESSAGE_" & tmpArr(4, i) & "</guid>" & VbCrLf)

		Write("			<title>" & ApplyXMLFormatting(tmpArr(0, i)) & " (" & ApplyXMLFormatting(tmpArr(3, i)) & ")</title>" & VbCrLf)

		Write("			<link>http://www.xxxxxxx.com/forum/showMessage.asp?M=" & tmpArr(4, i) & "&amp;F=" & ApplyXMLFormatting(tmpArr(5, i)) & "</link>" & VbCrLf)

		Write("			<description>" & VbCrLf)

		Write("				<![CDATA[" & VbCrLf)

		Write("					<strong>Message by " & tmpArr(0, i) & " on " & tmpArr(3, i) & " EST</strong><br />" & tmpArr(2, i) & VbCrLf)

		Write("				]]>" & VbCrLf)

		Write("			</description>" & VbCrLf)

		Write("			<pubDate>" & tmpArr(3, i) & "</pubDate>" & VbCrLf)

		Write("		</item>" & VbCrLf)

	Next : i = Null

	Erase tmpArr

End If

Write("	</channel>" & VbCrLf)

Write("</rss>" & VbCrLf)

Function ApplyXMLFormatting(ByVal strInput)

	If Not(IsNull(strInput)) Then

		ApplyXMLFormatting = Server.HTMLEncode(strInput)

	End If

End Function   

Sub Write(ByVal strString)

	Response.Write(strString)

End Sub

%>

Open in new window

0
 
LVL 25

Expert Comment

by:kevp75
Comment Utility
also note, there is nothing in the field Timestamp, however Timestamp1 contains a timestamp, so you may want to change the query to reflect this.
0
 
LVL 31

Author Closing Comment

by:James Murrell
Comment Utility
AAA+++ wish i could give more points - that is great big thanks -
0
 
LVL 25

Expert Comment

by:kevp75
Comment Utility
glad I could help!
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
Read about why website design really matters in today's demanding market.
In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…
The viewer will learn how to count occurrences of each item in an array.

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now