Jump to content

Fetch client details through customfields ? (external API)


gabe

Recommended Posts

Instead of searching for the client through their IDs, I want to search it through their customfields, specifically customfields1.

 

Here's an example of how I tried to achieve it (and failed):

 

$postfields["action"] = "getclientsdetails";

//$postfields["clientid"] = "100";

$postfields["customfields1"] = "14.111.580000180";

 

The code above does not work, it fetches the first client details.

 

Is there a way to do this?

Link to comment
Share on other sites

You mean query whmcs mysql database on each client until customfield = the one I'm looking for?

 

I tried encapsulating the whole code on a while loop and search through each client until I get a match on the custom fields. This works, but the search takes forever because each loop has to load the API all over again.

Link to comment
Share on other sites

you can simply do it with one query, i don't what exactly you need to do but as an example i can select clients information when customfield1 >= 1 :

 

SELECT `tblclients`.*, `tblcustomfieldsvalues`.* FROM `tblclients`, `tblcustomfieldsvalues` WHERE `tblclients`.`id`=`tblcustomfieldsvalues`.`relid` AND `tblcustomfieldsvalues`.`fieldid`='1' AND `tblcustomfieldsvalues`.`value`>1

 

try it in PHPMyAdmin to see how its work

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated