Jump to content

Recommended Posts

Hey there. I can't seem to find what I'm looking for by searching because I apparently don't know what to search.

 

What I have is a list of rows where clients can select an item and how many they want of the item. It would then create a row in a table saying that they want x amount of Item X. Each of these items also have a price, and that's ultimately what I'm trying to add up. However, the part that I'm having trouble with is getting it to see that there are quantities.

 

Here is an example...

 

QTY

| Item

| Price

| Price * QTY

1

| Item

| $10

| $10

3

| Item

| $5

| $15

1

| Item

| $50

| $50

6

| Item

| $25

| $150

[/td]

[td]

| Sub

| ??

 

I want to know how to get the answer for the ?? in there. I basically have a result to get each of the "Price * QTY"s, but I can't figure out how to add them together.

 

$i = 0;
$query3 = mysql_query("select * FROM items WHERE oid='$id'");
while($item = mysql_fetch_array($query3)){
$i++;
  $price = $item['price'];
  $quantity = $item['quantity'];
  $pricexqty = $price * $quantity;

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.