简体   繁体   中英

Changing select_query to mysql_query?

Here is the line of code that my select_query is being used in:

$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");

Here is the syntax it is using:

select_query($table,$fields,$where,$sort,$sortorder,$limits,$join) 

You can view the docs on this here: http://docs.whmcs.com/SQL_Helper_Functions

Can anyone figure out how to change the select_query into a normal mysql_query that I can use within my Smarty template system? I've been trying out tons of different ways and all of them return a blank array... Any help would be super appreciated!

I have no idea what you are trying to do, but the query this code builds is the following:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM