I've created a custom table in the WHMCS DB, and would now like to display the contained table data on a custom page I've also created, in the form of an html table.
In mycustompage.php, I've passed the data to an array like so:
Then in mycustompage.tpl (using the clientareainvoices.tpl as a 'template') I've done the following:
However the above just populates every row with the results from the first row of my custom DB table (tblclientscustom).
Have I made a mistake in setting the variable/array $customdata?
Also what is the 'item=customdata' setting? in the clientareainvoices.tpl template it's set to 'item=invoice'. Have I set this wrong too?
Any help appreciated.
In mycustompage.php, I've passed the data to an array like so:
PHP Code:
$result = mysql_query("SELECT * FROM tblclientscustom WHERE userid=".$ca->getUserID());
$data = mysql_fetch_array($result);
$customdata = $data;
$ca->assign('customdata', $customdata);
Code:
{foreach from=$customdata item=customdata}
<tr>
<td>{$customdata.id}</td>
<td>{$customdata.domain}</td>
<td>{$customdata.email}</td>
<td>{$customdata.organization}</td>
<td >{$customdata.timestamp}</td>
<td><a href="viewcustdata.php?id={$customdata.id}">{$LANG.customdataview}</a></td>
</tr>
{foreachelse}
<tr>
<td colspan="5">{$LANG.norecordsfound}</td>
</tr>
{/foreach}
Have I made a mistake in setting the variable/array $customdata?
Also what is the 'item=customdata' setting? in the clientareainvoices.tpl template it's set to 'item=invoice'. Have I set this wrong too?
Any help appreciated.