ThinkPHP中查询语句如何写?
类似于QQ的那种,一个用户信息表,用户有一些好友,我如何将用户的好友信息查询出来显示在页面.谢谢各位GGMM啦!
------解决方案--------------------
------解决方案--------------------
至少你应该给出相关的表结构
------解决方案--------------------
跟框架有什么关系呢
你设计相关的数据库,相应的搜索数据即可
你可以贴出用户表和好友表的结构
------解决方案--------------------
大概语句,,,假设需要useraccount ,,
SELECT f.*, u.useraccount FROM usersfriend AS f LEFT JOIN [user表名] AS u ON f.frienduserid=u.userid WHERE f.userid=[要找的用户id] <br><font color="#e78608">------解决方案--------------------</font><br>tp的联合查询不会,我用tp也是直接 query(sql语句) <br><font color="#e78608">------解决方案--------------------</font><br> 基本SQL:<br>select usersfriend.*<br> from usersfriend, userinformation<br> where usersfriend.frienduserid = userinformation.userid<br><br><font color="#e78608">------解决方案--------------------</font><br>路过,积点分 <div class="clear"></div>
PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号