Discussion:
Hmmm.. I think I need your advice here to get in correct direction...
Karl-Arne Gjersøyen
2013-07-10 12:30:23 UTC
Permalink
I am almost ready with my learning project in PHP/MySQL.
I can register new product in stock.
Add and increase the number and weight.
I can move products between different storehouses
I can also transfer products from store and onto a "truck document" but
that's it and here I need some advice.

I like to register new products and the amount in number (for example 4)
and weight in kg.

I like to write it in this way:
Dynamite - package 4 - Weight 200 kg
Lunt - Package 10
Karl-Arne Gjersøyen
2013-07-10 12:37:06 UTC
Permalink
Sorry, the first mail in this subject run out for me. This is an updated
one.



I am almost ready with my learning project in PHP/MySQL.
I can register new product in stock.
Add and increase the number and weight.
I can move products between different storehouses
I can also transfer products from store and onto a "truck document" but
that's it and here I need some advice.

I like to register new products and the amount in number (for example 4)
and weight in kg.

I like to write it in this way:
Dynamite - package 4 - Weight 200 kg
Lunt - Package 10 - Weight 10kg

Then I like to 4+10 = 14
and 200+10 = 210.

It shall looks like this:
======================================
Dynamite | 4 | 200
Lunt | 10 | 10
------------------------------------------------------------------
TOTAL | 14 | 210

It is easy to register this product by product on their own row.
but in what way can I multiply them? ned products be stored in arrays?
I think it will be similar to shopping cart in online store but i have no
clue about how to do this.
If you have links to pages were i can learn am i Happy for it. If you can
help me here is even better.

Thanks for your time and effort to learn me programming.

Karl
--
Hjemmeside: http://www.karl-arne.name/
Jim Giner
2013-07-10 12:59:11 UTC
Permalink
Post by Karl-Arne Gjersøyen
Sorry, the first mail in this subject run out for me. This is an updated
one.
I am almost ready with my learning project in PHP/MySQL.
I can register new product in stock.
Add and increase the number and weight.
I can move products between different storehouses
I can also transfer products from store and onto a "truck document" but
that's it and here I need some advice.
I like to register new products and the amount in number (for example 4)
and weight in kg.
Dynamite - package 4 - Weight 200 kg
Lunt - Package 10 - Weight 10kg
Then I like to 4+10 = 14
and 200+10 = 210.
======================================
Dynamite | 4 | 200
Lunt | 10 | 10
------------------------------------------------------------------
TOTAL | 14 | 210
It is easy to register this product by product on their own row.
but in what way can I multiply them? ned products be stored in arrays?
I think it will be similar to shopping cart in online store but i have no
clue about how to do this.
If you have links to pages were i can learn am i Happy for it. If you can
help me here is even better.
Thanks for your time and effort to learn me programming.
Karl
Ahhh.....

So - you should run a query that selects the products and information
that you want. Then you start by creating an html table header and then
loop through your query results and echo a table row for each result row.

// start the table
echo "<table border=1>";
echo "<tr><th>Product</th><th>Amount</th></tr>";

// loop thru each item found
while ($results = $qrslts->fetch(PDO::FETCH_ASSOC))
{
echo
"<tr><td>".$results['product_name']."</td><td>".$results['product_amt']."</td></tr>";
}

// finish the table html
echo "</table";
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Karl-Arne Gjersøyen
2013-07-10 13:07:34 UTC
Permalink
Post by Karl-Arne Gjersøyen
Sorry, the first mail in this subject run out for me. This is an updated
one.
I am almost ready with my learning project in PHP/MySQL.
I can register new product in stock.
Add and increase the number and weight.
I can move products between different storehouses
I can also transfer products from store and onto a "truck document" but
that's it and here I need some advice.
I like to register new products and the amount in number (for example 4)
and weight in kg.
Dynamite - package 4 - Weight 200 kg
Lunt - Package 10 - Weight 10kg
Then I like to 4+10 = 14
and 200+10 = 210.
==============================**========
Dynamite | 4 | 200
Lunt | 10 | 10
------------------------------**------------------------------**------
TOTAL | 14 | 210
It is easy to register this product by product on their own row.
but in what way can I multiply them? ned products be stored in arrays?
I think it will be similar to shopping cart in online store but i have no
clue about how to do this.
If you have links to pages were i can learn am i Happy for it. If you can
help me here is even better.
Thanks for your time and effort to learn me programming.
Karl
Ahhh.....
So - you should run a query that selects the products and information that
you want. Then you start by creating an html table header and then loop
through your query results and echo a table row for each result row.
// start the table
echo "<table border=1>";
echo "<tr><th>Product</th><th>**Amount</th></tr>";
// loop thru each item found
while ($results = $qrslts->fetch(PDO::FETCH_**ASSOC))
{
echo "<tr><td>".$results['product_**name']."</td><td>".$results['**
product_amt']."</td></tr>";
}
// finish the table html
echo "</table";
Yes that part is OK. I do have problem to add total weight and package at
bottom of the table like this:

Product_one 40kg
Product_two 60kg
-------------------------
Total: 100kg
===============

Because sometimes it is only a few products and other times many products.
I then need to summing them at bottom. One timer only 3 rows, other times
20 rows. The program need a way to add every singel product and see if it's
a few or many,

Karl
Jim Giner
2013-07-10 13:20:45 UTC
Permalink
Post by Karl-Arne Gjersøyen
Post by Karl-Arne Gjersøyen
Sorry, the first mail in this subject run out for me. This is an updated
one.
I am almost ready with my learning project in PHP/MySQL.
I can register new product in stock.
Add and increase the number and weight.
I can move products between different storehouses
I can also transfer products from store and onto a "truck document" but
that's it and here I need some advice.
I like to register new products and the amount in number (for example 4)
and weight in kg.
Dynamite - package 4 - Weight 200 kg
Lunt - Package 10 - Weight 10kg
Then I like to 4+10 = 14
and 200+10 = 210.
==============================**========
Dynamite | 4 | 200
Lunt | 10 | 10
------------------------------**------------------------------**------
TOTAL | 14 | 210
It is easy to register this product by product on their own row.
but in what way can I multiply them? ned products be stored in arrays?
I think it will be similar to shopping cart in online store but i have no
clue about how to do this.
If you have links to pages were i can learn am i Happy for it. If you can
help me here is even better.
Thanks for your time and effort to learn me programming.
Karl
Ahhh.....
So - you should run a query that selects the products and information that
you want. Then you start by creating an html table header and then loop
through your query results and echo a table row for each result row.
// start the table
echo "<table border=1>";
echo "<tr><th>Product</th><th>**Amount</th></tr>";
// loop thru each item found
while ($results = $qrslts->fetch(PDO::FETCH_**ASSOC))
{
echo "<tr><td>".$results['product_**name']."</td><td>".$results['**
product_amt']."</td></tr>";
}
// finish the table html
echo "</table";
Yes that part is OK. I do have problem to add total weight and package at
Product_one 40kg
Product_two 60kg
-------------------------
Total: 100kg
===============
Because sometimes it is only a few products and other times many products.
I then need to summing them at bottom. One timer only 3 rows, other times
20 rows. The program need a way to add every singel product and see if it's
a few or many,
Karl
So - as you loop thru the results, accumulate your totals and then at
the end before you close the table generate one last row with those
amounts in it. Simple!
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Lester Caine
2013-07-10 13:25:11 UTC
Permalink
Post by Karl-Arne Gjersøyen
Post by Jim Giner
// start the table
$total = 0;
Post by Karl-Arne Gjersøyen
Post by Jim Giner
Post by Jim Giner
echo "<table border=1>";
echo "<tr><th>Product</th><th>**Amount</th></tr>";
// loop thru each item found
while ($results = $qrslts->fetch(PDO::FETCH_**ASSOC))
{
echo "<tr><td>".$results['product_**name']."</td><td>".$results['**
product_amt']."</td></tr>";
$total += $results['product_amt']
Post by Karl-Arne Gjersøyen
Post by Jim Giner
Post by Jim Giner
}
echo "<tr><td>Total:</td><td>".$total."</td></tr>";
Post by Karl-Arne Gjersøyen
Post by Jim Giner
Post by Jim Giner
// finish the table html
echo "</table";
Yes that part is OK. I do have problem to add total weight and package at
Product_one 40kg
Product_two 60kg
-------------------------
Total: 100kg
===============
--
Lester Caine - G8HFL
-----------------------------
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk
Rainbow Digital Media - http://rainbowdigitalmedia.co.uk
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Karl-Arne Gjersøyen
2013-07-10 14:56:04 UTC
Permalink
Post by Lester Caine
Post by Jim Giner
// start the table
$total = 0;
Post by Jim Giner
echo "<table border=1>";
echo "<tr><th>Product</th><th>****Amount</th></tr>";
// loop thru each item found
while ($results = $qrslts->fetch(PDO::FETCH_****ASSOC))
{
echo "<tr><td>".$results['product_****name']."</td><td>".$results['
****
product_amt']."</td></tr>";
$total += $results['product_amt']
}
echo "<tr><td>Total:</td><td>".$**total."</td></tr>";
Post by Jim Giner
// finish the table html
echo "</table";
Yes that part is OK. I do have problem to add total weight and package at
Product_one 40kg
Product_two 60kg
-------------------------
Total: 100kg
===============
Thank you very Much, Both of you Jim and Lester!
You are amazing, folks!

Karl

Jim Giner
2013-07-10 12:52:34 UTC
Permalink
Post by Karl-Arne Gjersøyen
I am almost ready with my learning project in PHP/MySQL.
I can register new product in stock.
Add and increase the number and weight.
I can move products between different storehouses
I can also transfer products from store and onto a "truck document" but
that's it and here I need some advice.
I like to register new products and the amount in number (for example 4)
and weight in kg.
Dynamite - package 4 - Weight 200 kg
Lunt - Package 10
Show us your code?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Loading...