我想做一个 PDO 请求,该请求将从 2 个不同的表中获取信息,但事情很快变得困难,我解释说:
我有一个像这样组织的第一个数据库表(花)(但它确实比我向您展示的要大):
ID; name; price of format 1; price of format 2; name of other format 3; price of other format 3;
FLOW0001; big yellow flower; ; 15,99; more big format; 34,99;
FLOW0002; little red flower; 5,99; 8,99; ; ;
……就这样继续……
第二个表(树)是这样的:
ID; name; name of format; price of format;
TREE0001; OMG BIG TREE !; F*** big format; 599,99;
TREE0001; OMG BIG TREE !; F*** even bigger format; 899,99;
TREE0002; litte ugly tree; little format; 20,99;
……就这样继续……
问题是我想“合并”这两个表,并将它们显示在这样的页面中:
while ($datas =$response->fetch()) //fetching the tables, they will be togheter and ordered by (their biggest) price. So, trees and flowers will blend.
{
// then echo the fetched datas. I will need to separate the prices and show them... some if/else based on pregmatches of the ID to know if it's an TREE or FLOW.
}
如何混合这个?我没有想法。最糟糕的是,我需要做一个页面系统(每页 50 个)。在页面系统和页面中,所有重复的树都需要显示为唯一的树......帮助!