Re: Who to make an additon of fetched rows
| From: | K.Simon | Date: | Tue, 16 Jan 2001 18:06:45 +0000 |
| Subject: | Re: Who to make an additon of fetched rows | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-34871@lists.php.net to get a copy of this message | ||
yeah, but if the user has 20 items in the cart (=20 rows), how do i show the endprice of his items?
In the below example it just prints all the rows from the user but i want to make a simple
mathematical addition $DMB+$DMB+$DMB and so on as rows for this user exists. It might simple for you
but not for a "newcomer" :)
*********** REPLY SEPARATOR ***********
On 16/01/2001 at 8:51 Chris Lee wrote:
>well your code snipit allready shows your answer.
>
>$result = mysql_db_query($DBName, "SELECT * FROM basket WHERE
>UserID='$UID'");
>while ($row = mysql_fetch_array($result))
>{
> $CID = $row[0];
> $DMN = $row[1];
> $DMB = $row[2];
> $BID = $row[4];
>
> echo "Price: $DMB<br>\n";
>}
>
>Chris Lee
>Mediawaveonline.com
>
>
>
>""K.Simon"" <phpsoft@zabia.net> wrote in message
>news:200101161642430703.055992B6@192.168.0.2...
>How can i add all the fetched rows from a table?
>
>$result=mysql("$DBName","SELECT * FROM basket WHERE
>UserID='$UID'");
>while ($row = mysql_fetch_array($result)) {
>$CID=$row[0];
>$DMN=$row[1];
>$DMB=$row[2];
>$BID=$row[4];
>do{
>print "$DMB";
>}
>
>
>Let's say i have to display the endprice from all the items from user $UID
>in the basket. Price from the items is in row $[2] or $DMB. How can i do
>that?
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
>For additional commands, e-mail: php-general-help@lists.php.net
>To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
>
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
>For additional commands, e-mail: php-general-help@lists.php.net
>To contact the list administrators, e-mail: php-list-admin@lists.php.net