Jump to content

RSS generated through PHP


anevins

Recommended Posts

I'm trying to generate RSS by using PHP and MySQL but I keep getting an error message that I don't know how to solve.

 

Here's the error message:

<b>Deprecated</b>:  Function mysql_db_query() is deprecated in <b>G:\xampp\htdocs\xampp\dsa\class_rss.php</b> on line <b>32

 

Here's line 32:

		$result = mysql_db_query (DB_NAME, $query, LINK);

 

Here's the entire code from the class:

<?
// code followed from http://www.webreference.com/authoring/languages/xml/rss/custom_feeds/
// images sourced: http://www.inyourbasket.com/search/usb-flash-drives/09A?cm_mmc_o=7BBTkw*Vzbp+mwzygt*JmP+4wFByY+mfbgLl*JmP+4wFByY+mfbgL+C+7wEwybg&gclid=CKuGh8DwyKcCFYFB4QodyGRvBg
class RSS
{
// function to include the file which holds global variables.
public function RSS()
{
	require_once ('connectvars.php');
}

// function derived from both private functions.
public function GetFeed()
{
	return $this->getDetails() . $this->getItems();
}

// function to connect to the database	
private function dbConnect()
{
	DEFINE ('LINK', mysql_connect (DB_HOST, DB_USER, DB_PASSWORD));
}

// function to retreive data from the table, and insert between set xml tags which loops through the rows in the table.	
private function getDetails()
{
	$stick = "stick,";
	$location = "location,";
	$identification = "identification";
	$this->dbConnect($stick, $location, $identification);
	$query = "SELECT * FROM ". $stick . $location . $identification;
	$result = mysql_db_query (DB_NAME, $query, LINK);

	while($row = mysql_fetch_array($result))
	{
		$details = '<?xml version="1.0" encoding="ISO-8859-1" ?>
				<rss version="2.0">
					<channel>
						<title>'. $row['stick.make'] .'</title>
						<description>'. $row['stick.colour'] . $row['location.street'] . $row['location.town'] . $row['location.city'] .'</description>
						<image>
							<url>'. $row['identification.image_url'] .'</url>
							<width>'. $row['identification.image_width'] .'</width>
							<height>'. $row['identification.image_height'] .'</height>
						</image>';
	}
	return $details;
}

// function to iterate through the table, retreiving data each time and outputting an end result of an RSS structured page.
private function getItems()
{
	$stick = "stick,";
	$location = "location,";
	$identification = "identification";
	$this->dbConnect($stick, $location, $identification);
	$query = "SELECT * FROM ". $stick . $location . $identification;
	$result = mysql_db_query (DB_NAME, $query, LINK);
	$items = '';
	while($row = mysql_fetch_array($result))
	{
		$items .= '<item>
					 <title>'. $row["stick.make"] .'</title>
					 <description><![CDATA['. $row["stick.colour"] .']]></description>
				 </item>';
	}
	$items .= '</channel>
			 </rss>';
	return $items;
}

}

?>

 

Could anyone help me out here?

Thanks

Link to comment
https://forums.phpfreaks.com/topic/230413-rss-generated-through-php/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.