私はphpで次の関数を作成しました。smarty ファイルから呼び出したいのですが、smarty からエラーが発生し続けます。私は何を間違っていますか?
<?php
function getCommission($inputid)
{
$database="xxxxxxxxxxxxxx";
mysql_connect (xxxxxxxxxxxxxxxxx);
@mysql_select_db($database) or die( "Unable to select database");
$data = mysql_query("SELECT * FROM hb_aff WHERE id = $inputid")
or die(mysql_error());
while($info = mysql_fetch_array( $data ))
{
return $info['total_commissions'];
}
}
?>
tpl コードの一部は次のとおりです。
{include file="getCommission"}
<tr>
<td >{$lang.convrate}</td>
<td >{$affiliate.conversion} %</td>
<td >{$lang.commissions}</td>
<td ><input size="3" value="{getCommission($affiliate.id}" name="total_commissions"/></td>
</tr>