Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
finidng total for columns
Old 05-11-2008, 01:39 AM finidng total for columns
Novice Talker

Posts: 12
Trades: 0
how would i find the each total for 2 columns with the same variable?
this is my code to get the values from the db and display in the correct column based on the criteria

<?
if ($created <= $sqldate && $created >=$sqldate2) {
?>
<td><?=$finish?></td>
<td>&nbsp;</td>
<? } else {
?>
<td>&nbsp;</td>
<td><?=$finish?></td>
<? } ?>
feelice is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 05-11-2008, 03:21 AM Re: finidng total for columns
addonchat's Avatar
Super Talker

Posts: 115
Name: Chris Duerr
Trades: 0
That code doesn't 'get the values from the db' -- I see two variables that look like they may come from your database ($sqldate and $sqldate2) -- Where's your current query code?

Can you clarify your original question? '2 columns with the same variable' doesn't make much sense to me. If you're trying to add all of the fields from one column in a table, you would use the SQL SUM() function. For two columns, you would typically construct one query (e.g., "SELECT SUM(x) AS sum_x, SUM(y) as sum_y FROM table_name", then use php to add the two results together.
__________________
Chris Duerr
AddonChat Java Chat Software

Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE
addonchat is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to finidng total for columns
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.54049 seconds with 12 queries