简体   繁体   English

解析数据库以创建RSS feed

[英]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. 嗨,我正在尝试从php创建rss,但成功,但是我在获取所有信息时遇到了麻烦。

The database is a Wordpress install. 该数据库是Wordpress安装。

I have a post which contains 2 images. 我有一个帖子,其中包含2张图片。 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 . 在数据库中,这2张图片和帖子都作为三个单独的行存储在同一张表中,但通过'post_type'字段进行区分。

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. 据我所知,有多个可定制的rss feed用于wordpress插件,您不必执行任何select语句,只要单击所需的结果即可。

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. 为了对worldpress db进行选择查询并从中手动生成rss,从长远来看,您可能会遇到问题,因为wordpress更新会带来潜在的结构更改。

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. 强烈建议您使用官方插件页面中的此类功能,通常这些功能具有适应wordpress直到现在的各种版本更改的历史。

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). 我找不到可以用来完成此工作的WordPress插件(尽管我确定可能有一个)。 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. 我使用了FlySpeed SQL查询 ,并像魔术一样创建了它。 I think there may be some tweaking I still need to do but I know that is close to the mark. 我认为可能仍需要进行一些调整,但我知道这已经接近目标。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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