Database help

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
chidolifetime
Forum Newbie
Posts: 1
Joined: Wed Aug 24, 2005 5:30 am

Database help

Post by chidolifetime »

hi there,
I got some prob here hope you can help out.
Need to create a simple stock management program. Done all great but accounter 2 probs.

1
need to find an easy way to do some calculations like additonning amount in a column. like after having the amount by multiplying QTY*Unitprice in a column called Amount, I want to add all the amount in the column to have the total amount Per order or per invoice for example. Hope you have easy way of doing this.

2
I want to print out. But I can not get a good looking printout eventhough it look great on the computer screen.

Or is there an easy way of exporting the table in excel where i can carry out necessary calculation and print out?

Will appreciate your help.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

  1. typically done like so:

    Code: Select all

    SELECT SUM(QTY*Amount) FROM `table` WHERE `condition` = 'foo'
  2. generating a PDF can be a good solution, setting up the screen to work properly with printing it directly can also work. You could export the information as a CSV as well (there has been talk about this a LOT here, look through the Code Snippets board. I blieve one is in there..)
Post Reply