gpt4 book ai didi

php - 在数组中使用 join 和 push 结果

转载 作者:太空宇宙 更新时间:2023-11-03 12:07:16 26 4
gpt4 key购买 nike

我有两个表,名称和图片

名称表:

enter image description here

图片表:

enter image description here

我想在 php 中编写一个函数(通过使用 sql),它获取一个 id 并返回这样的结果:

//假设我向这个函数发送了 1...

result = array("name"=>"Name1","pics"=>"url6-url7");

URLS 中有连字符。

有什么帮助吗?

最佳答案

`Try this code its working 

SELECT GROUP_CONCAT(category.pics SEPARATOR '-') as newpics, company.id as searchid FROM `category` inner join company on (company.id = category.cmp_id) where category.cmp_id = 2

关于php - 在数组中使用 join 和 push 结果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25931533/

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