Hello,
I am trying to add a little math into my current function. The page displays the name, description and price of products. Those are taken out of my sql database.
The price however, has a starting amount for administration costs and it has a multiplier. Eg. Let’s say a price is 236,56. Add administration cost is (+5) 241,56. Then add the multiplier (of 1,85) so the total price is 466,886. However, I need all my prices to be rounded per 5 dollars. Meaning 466,886 will become 450. And 234,28 will become 235. And so on.
This function is included in the script. However, it only seems to work for the first column… And not for the other columns. The other columns display nothing at all.
Here’s the script:
<table width="100%" border="0" rules="groups" table class="table">
<thead>
</thead>
<tbody>
HTML;
while ($row = mysql_fetch_assoc($result)){
$row['price'] = round ((($row['price']+5) *1.85),0);
$base_m=5;
$row['price1'] = $base_m*(ceil(($row['price'])/$base_m));
echo <<<HTML
<tr>
<td align="center" width="25%"><img src={$row['thumb_name']}><br> {$row['name']}<br>
{$row['description']}<br />
{$row['price1']}<br>
</td>
<td align="left" width="0%">
</td>
HTML;
$row = mysql_fetch_assoc($result);
if (!$row){
echo "<td> </td><td> </td>";
} else {
echo <<<HTML
<td align="center" width="25%"><img src={$row['thumb_name']}><br> {$row['name']}<br>
{$row['description']}<br />
{$row['price1']}<br>
</td>
<td align="left" width="0%">
</td>
HTML;
}
$row = mysql_fetch_assoc($result);
if (!$row){
echo "<td> </td><td> </td>";
} else {
echo <<<HTML
<td align="center" width="25%"><img src={$row['thumb_name']}><br> {$row['name']}<br>
{$row['descrription']}<br />
{$row['price1']}<br>
</td>
<td align="left" width="0%">
</td>
HTML;
$row = mysql_fetch_assoc($result);
if (!$row){
echo "<td> </td><td> </td>";
} else {
echo <<<HTML
<td align="center" width="25%"><img src={$row['thumb_name']}><br> {$row['name']}<br>
{$row['description']}<br />
{$row['price1']}<br>
</td>
<td align="left" width="0%">
</td>
HTML;
}} //end if
echo "</tr>";} //end whileecho <<<HTML
</tbody>
<tfoot>
<tr>
<p>
<th colspan="4">
$pageNavBar
</th>
</tr>
</tfoot>
</table>
Any idea what I must change or how I can fix it? Thx!!