Discuz!官方免费开源建站系统

 找回密码
 立即注册
搜索

[已答复] 模块中用sql语句,如何使用自定义信息,分享

[复制链接]
0523e 发表于 2009-9-25 15:35:08 | 显示全部楼层 |阅读模式
在列表页我们查询一般都是supe_spaceitems,和supe_attachments,而自定义信息字段 customfieldtext在 supe_spacenews表 中

所以写了个函数取出:
  1. function getVurl($itemid )
  2. {

  3. global $_SGLOBAL;




  4.         $query = $_SGLOBAL['db']->query('SELECT customfieldtext FROM `supe_spacenews` where itemid = '.$itemid );
  5.         if ($r_array = $_SGLOBAL['db']->fetch_array($query)) {
  6.                 $results = $r_array[customfieldtext];
  7.         }


  8.          $results=unserialize($results);//取出后要反序列化
  9.          return  $results[0];




  10. }
复制代码
不知道大家有什么更好的方法!
回复

使用道具 举报

littlehz 发表于 2009-9-25 16:29:11 | 显示全部楼层
这个可以通过模块实现,不必修改程序文件
https://discuz.dismall.com/thread-1413249-1-1.html
回复

使用道具 举报

lidq.jingwu 发表于 2009-9-25 16:31:19 | 显示全部楼层
你这个方法已经很好了,想不到更好的方法!!
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|Discuz! 官方站 ( 皖ICP备16010102号 )star

GMT+8, 2025-9-14 02:19 , Processed in 0.096127 second(s), 14 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

快速回复 返回顶部 返回列表