I need to generate a list of activity from multiple tables in order of the date they were entered into the tables, but when I spit them out (with php), I want each result to look specific to a design that I have for each table.
我需要按照它们输入表中的日期顺序从多个表生成一个活动列表,但是当我吐出它们(用php)时,我希望每个结果都看起来特定于我对每个表的设计。
I.e... I have the tables: listings
, photos
, comments
我......我有桌子:列表,照片,评论
- The results from listings should be designed a certain way, the results from photos should be designed a different way, the results from comments should be designed a third way.
- I would like to mesh the results from all three tables into one date-ordered list.
列表的结果应该以一定的方式设计,照片的结果应该以不同的方式设计,评论的结果应该以第三种方式设计。
我想将所有三个表的结果网格化为一个按日期排序的列表。
I can pull the results with a MySQL join, but I don't know how to alter the results according to the table.
我可以使用MySQL连接来提取结果,但我不知道如何根据表格更改结果。
Does this make a sense?
这有道理吗?
1 个解决方案
#1
The process is this:
过程是这样的:
- Query Database, get results back ordered by date
- Iterate over results creating table, based on date/variable you will assign a CSS class to the current row you are creating. (use an if/switch/function etc. to figure out what class should be assigned)
- After iteration is done complete the table / etc. and display.
查询数据库,按日期排序返回结果
迭代结果创建表,根据日期/变量,您将CSS类分配给您正在创建的当前行。 (使用if / switch / function等来确定应该分配哪个类)
迭代完成后,完成表格等并显示。
#1
The process is this:
过程是这样的:
- Query Database, get results back ordered by date
- Iterate over results creating table, based on date/variable you will assign a CSS class to the current row you are creating. (use an if/switch/function etc. to figure out what class should be assigned)
- After iteration is done complete the table / etc. and display.
查询数据库,按日期排序返回结果
迭代结果创建表,根据日期/变量,您将CSS类分配给您正在创建的当前行。 (使用if / switch / function等来确定应该分配哪个类)
迭代完成后,完成表格等并显示。