Quantcast
Channel: WHMCS Community Forums
Viewing all articles
Browse latest Browse all 13458

Custom Page, Service Array - AutoPay.php

$
0
0
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

Code:

$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:

Code:

{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.

Viewing all articles
Browse latest Browse all 13458

Trending Articles