This is my code in tmpl/defult.php of my Joomla 2.5 module:
$result = count($payed);
for($i=0;$i<$result;$i++)
{
$pay=F.$payed[$i];
echo "<td>".JText::_("$pay")."</td>";
echo "<td>".number_format($item->$pay)."</td>";
$paytotal=$pay+$paytotal; // For last result
echo "</tr>";
}
$payed
is an Array
. I get it from user and exploding by this Code :
$p = $params->get('pay_fields');
$payed = explode ("\n", $p);
in language file of this module I used general names for module parameters, like these :
F1="pay1"
F2="Pay2"
F5="Pay3"
F6="Pay4"
and my table in Database has column name like this:
F1 | F2 | F3 | F4 | F5 | F6 | F....
---------------------------------------------------
12 | 1247 | 1056 | 2368 | 2256 | 12510| ...
I want to make a table from all user entered database fileds. For example when user types in module parameters
1
2
5
6
script must be read F1,F2,F5 and F6 from Database and make table . I know script do this , but not exactly true ! it just shows last result ! and set 0 for other parameters! what's wrong ?
Know Module shows this result in frontend :
--------------------------------
F1 | 0
--------------------------------
F2 | 0
--------------------------------
F5 | 0
--------------------------------
Pay4 | 12,510