gpt4 book ai didi

php - 使用多个 while 循环从多个数据库表中获取多个数据

转载 作者:行者123 更新时间:2023-11-29 00:29:41 24 4
gpt4 key购买 nike

我有三个表,即标题、图像、列表。 title 表有一个 auto_increment id,它作为引用 id 出现在其他两个表中,除了这两个表有自己的 auto_increment pid 和 lid,我想使用 while 循环从所有表中获取记录。

eg.
my title table has

id title
1 nirman
2 meditation

my image table has

pid id image
1 1 1.jpg
2 1 2.jpg
3 2 6.jpg

and my list table has

lid id list
1 1 serve us....
2 1 web service
3 1 cms
4 2 about

我有不同的部门来显示来自图像和列表的所有数据,其中标题来自标题表。如果您能理解我想问的问题,请回复相关代码,否则回复您无法理解的部分文字。

最佳答案

select title, image, list
from title t, image i, list l
where t.id = i.id
and t.id = l.id

关于php - 使用多个 while 循环从多个数据库表中获取多个数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17191908/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com