简体   繁体   中英

Parse a database to create RSS feed

Hi I am trying to create rss from php which is successful, but I am having trouble getting all of the information.

The database is a Wordpress install.

I have a post which contains 2 images. In the database these 2 images and the post are all stored as three individual rows in the same table, but differentiated by the 'post_type' field .

I then have extra information attached to each post but this is contained in a seperate table.

What sort of select statement should I be using to perform something like this? Any help would be greatly appreciated.

Thanks and Regards,

AS i know, there are several customizable rss feed plugins for wordpress, in which you dont have to do any select statements, olny click in the desired results.

In order to do a select query on worldpress db, and generating the rss manually from it, on the long run you chould get into problems as on a potentional structure change that comes with a wordpress update.

It is highly recommended to use such features from the official plugins page, usually the ones that have a history of adapting to the various versionchanges that wordpress gone throug untill this time.

Thank you all for all the info. I could not find a WordPress plugin which I could use to get this working (though I'm sure there probably is one). But I managed to get this working. This is what I ended up with:

'Select
 mwpwpecbd.*,
 mwpposts.*,
 imageposts.guid As guid1,
 imageposts.post_type As post_type1,
 imageposts.ID As ID1,
 imageposts.post_title As post_title1,
 mwpposts.post_parent,
 imageposts.post_parent As post_parent1
 From
 mwpwpecbd Inner Join
 mwpposts On mwpposts.ID = mwpwpecbd.post_id Inner Join
 mwpposts imageposts On imageposts.post_parent = mwpposts.ID'

I used FlySpeed SQL Query and created it like magic. I think there may be some tweaking I still need to do but I know that is close to the mark.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM