newbie function question
| From: | Cory Berry-CP | Date: | Fri, 30 Jun 2000 19:10:50 +0000 |
| Subject: | newbie function question | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-4108@lists.php.net to get a copy of this message | ||
Hello all, new to programming and php. please help.
I'd like to put the following into a function and am lost on how to go
about it.
thanks
$result = mysql_query ("SELECT * FROM current_holdings");
if ($row = mysql_fetch_array($result))
$ttl_rec = $row["amount"] * $row["price"] - $row["commission"];
$ttl_gain = $ttl_rec - $row["total_spent"];
then currently i put that into the table. (which does the job)
<td div align=center><?php echo $row["ticker"]?></td>
<td div align=center><?php echo $row["amount"]?></td>
<td div align=center><?php echo $row["price"]?></td>
<td div align=center><?php echo $row["commission"]?></td>
<td div align=center><?php echo $row["total_spent"]?></td>
<td div align=center><?php echo $ttl_rec ?></td>
<td div align=center><?php echo $ttl_gain ?></td>
Sincerely,
Cory