Jump to content

Custom Page, Service Array - AutoPay.php


dglynch

Recommended Posts

I am attempting to create a new custom page in WHMCS so I can pull client details when a client is logged in to pass to the page that sets up the autopay service.

 

It will be several pages but this first one seems to be the hardest, its where I am gather which service the customer wants to setup on autopay.

 

I am trying to use an array to pull all the Active services that do not have a subscription field in it. It seems the code I am using is maybe pulling only the first row in MySQL??????

 

This is the code I have in autopay.php

 

$result2 = mysql_query("SELECT * FROM tblhosting WHERE subscriptionid=' ' AND userid=".(int)$_SESSION['uid']);
$servicearray = mysql_fetch_array($result2);

$smartyvalues["servicearray"] = $servicearray;

 

Then in autopay.tpl I have the following right now:

 

{foreach from=$servicearray key=id item=i}
 <li>{$i.id} - {$i.packageid} - {i.amount}</li>
   {foreachelse}
<p>There are no services that qualify for AutoPay at this time.</p>
{/foreach}

 

I know I am missing ALOT from the tpl right now. I am basically wanting to know how to list the following from the tblhosting table that matches the SQL query:

 

ServiceID - PackageID - Amount

Next_ServiceID - Next_PackageID - Next_Amount

 

There will be more then just these three but I am using them as as example, I will then code that I need into the appropriate variables to pass to the next page.

 

Also not as important but just curious instead of showing the numeric packageid how do I pull from the service table and enter the common name for the service so instead of "10" it shows "Web Hosting Package Name".

 

I am sure its a few simple tweaks and that I am doing things wrong. Everyones help is much appreciated in advance.

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