以下是我select_query
正在使用的代码行:
$result = select_query("tblaffiliatespending", "SUM(tblaffiliatespending.amount)", array("affiliateid" => $id), "clearingdate", "DESC", "", "tblaffiliatesaccounts ON tblaffiliatesaccounts.id=tblaffiliatespending.affaccid INNER JOIN tblhosting ON tblhosting.id=tblaffiliatesaccounts.relid INNER JOIN tblproducts ON tblproducts.id=tblhosting.packageid INNER JOIN tblclients ON tblclients.id=tblhosting.userid");
以下是它使用的语法:
select_query($table,$fields,$where,$sort,$sortorder,$limits,$join)
您可以在此处查看相关文档:http://docs.whmcs.com/SQL_Helper_Functions
任何人都可以想出如何将select_query更改为我可以在我的Smarty模板系统中使用的普通mysql_query吗?我一直在尝试各种不同的方式,所有这些都返回一个空白阵列......任何帮助都会受到超级赞赏!
答案 0 :(得分:1)
我不知道您要做什么,但此代码构建的查询如下:
SELECT SUM(tblaffiliatespending.amount)
FROM tblaffiliatespending
JOIN tblaffiliatesaccounts ON tblaffiliatesaccounts.id=tblaffiliatespending.affaccid
INNER JOIN tblhosting ON tblhosting.id=tblaffiliatesaccounts.relid
INNER JOIN tblproducts ON tblproducts.id=tblhosting.packageid
INNER JOIN tblclients ON tblclients.id=tblhosting.userid
WHERE affiliateid=$id
ORDER BY clearingdate DESC