?
Solved

Creating an RSS Feed using PHP/Oracle

Posted on 2011-02-16
2
Medium Priority
?
489 Views
Last Modified: 2012-05-11
I am trying to create an rrs feed using PHP/Oracle. The code/example works perfect with Mysql but it crashes when I try the same code with Oracle. Database connection with Oracle is working fine. I tried so many combinations and codes but nothing works when I try to create RSS.
I have attached the code, 'll greatly appreciate any feedback.

Thanks.

Here's the part that's working fine and shows data. Please help me generate RSS feed. Thanks.
<?php

$conn = oci_connect('UserName', 'Password', 'ServerName/DatabaseName');

// Parse the statement. Note there is no final semi-colon in the SQL statement
$stid = oci_parse($conn, "SELECT * FROM FECapp.Cal_Event where location = 'Michigan' and url is NOT NULL");
$result = oci_execute($stid);

while ($row = oci_fetch_array($stid, OCI_ASSOC+OCI_RETURN_NULLS)) {
  echo "<br>";
  echo $row['EVENT_NAME'];
  echo "<br>";
  echo $row['LOCATION'];
  echo "<br>";
  echo $row['URL'];
}
?>

Open in new window

0
Comment
Question by:awarraic
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 8

Accepted Solution

by:
rationalboss earned 2000 total points
ID: 34912253
<?php

$conn = oci_connect('UserName', 'Password', 'ServerName/DatabaseName');
if (!$conn) {
	$e = oci_error();   // For oci_connect errors do not pass a handle
    trigger_error(htmlentities($e['message']), E_USER_ERROR);
}
// Parse the statement. Note there is no final semi-colon in the SQL statement
$stid = oci_parse($conn, "SELECT * FROM FECapp.Cal_Event where location = 'Michigan' and url is NOT NULL");
if (!$stid) {
	$e = oci_error();   // For oci_connect errors do not pass a handle
    trigger_error(htmlentities($e['message']), E_USER_ERROR);
}
$result = oci_execute($stid);
if (!$result) {
    $e = oci_error($stid);  // For oci_execute errors pass the statement handle
    print htmlentities($e['message']);
    print "\n<pre>\n";
    print htmlentities($e['sqltext']);
    printf("\n%".($e['offset']+1)."s", "^");
    print  "\n</pre>\n";
} 


while ($row = oci_fetch_array($stid, OCI_ASSOC+OCI_RETURN_NULLS)) {
  echo "<br>";
  echo $row['EVENT_NAME'];
  echo "<br>";
  echo $row['LOCATION'];
  echo "<br>";
  echo $row['URL'];
}
?>

Open in new window


If you are using < PHP 5.0, use ocierror() instead of oci_error()
0
 
LVL 111

Expert Comment

by:Ray Paseur
ID: 34920992
Your only problems so far may be in using Oracle, but eventually you will need to know about RSS.  The string your script creates here is not an RSS feed.  RSS is a specialized subset of XML.  You can learn more about the specific tags and formats here:
http://cyber.law.harvard.edu/rss/rss.html
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to count occurrences of each item in an array.
Suggested Courses

777 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