Adding the contents of several fields within 1 record

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
ippykinippy
Forum Newbie
Posts: 1
Joined: Wed Mar 21, 2007 1:59 pm

Adding the contents of several fields within 1 record

Post by ippykinippy »

I'm hoping someone can direct me to the right search string for the following:

I'm creating an online Timesheet (time tracking form for music instructors) using php/mysql.

I have several columns in my timesheet table for entering the hours an instructor has worked: "Admin-time", "Prep-time", "Class-time", etc. I'd like to add all of these into another column called "Total-Time".

I don't even know what words to search for. I tried for hours here and came up with nothing related.

I'm positive my ignorance is blinding and just hope for a little gesture in the right direction.

cheers,

ippy
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

It would be an UPDATE query. If done correctly, it wouldn't have a thing to do with PHP.
User avatar
mikeq
Forum Regular
Posts: 512
Joined: Fri May 03, 2002 3:33 am
Location: Edinburgh, Scotland

Post by mikeq »

In general you wouldnt store data in a database that has been calculated from other columns.

When displaying the information you would calculate it at that point. The usual exception to this is a data warehouse, where you would store pre-aggregated data etc for reporting performance reasons.

But for an application database I wouldn't store calculated columns.
Post Reply