Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    PHP


SuperbHosting.net have generously sponsored dedicated servers to ensure a reliable and scalable dedicated hosting solution for BigResource.com.





Totals From Database


In my database, I have users who each have a certain amount of minutes logged. What I want to do is display the total amount of minutes everybody has logged collectively. Can someone help me with some code that will add all the minutes of each user together? The furthest I've got in selecting the minutes from the database table.




View Complete Forum Thread with Replies

Related Forum Messages:
Database Delete Repeat Records And Add Up Totals
I have a database full of order records for our website. My goal is to delete people from the same 'address' field and add up the 'total' into one record. Can i get some example code on how this would be done?

View Replies !
Why The Totals Don't Add Up?
Can anyone tell me why the totals don't add up? PHP Code:

View Replies !
Monthly Totals
I have a table with some records. Only one record per day, but maybe none or lots per month. The values entered are valid for every day from the date of record to next record or today. The user enters a date, And i need two totals: the total for just the chosen month, and the balance (total of all records upto the chosen month). Code:

View Replies !
Totals In A Sql-table
I have a mysql table which stores points of users from a competition. I can
display the table with php, you see which user has points and how much, the
one with the highest points stands on one (off course).

But, I want to display the total amount of points of all users together form
the table standm in the column pts.

I really don't know how to get the total value of all values together. My
first idea is to do something with count, but this only counts the rows.

View Replies !
How Do I Get Totals From A Field?
I am building a simple income and expenditure app for myself, with seperate tables for income and

expenditure. The income table looks like the following:
id INT AUTO_INCREMENT PRIMARY KEY,
date DATE,
income1 INT(10) NULL,
icome2 INT(10) NULL,
income3 INT(10) NULL,
income4 INT(10) NULL,
etc

What has stumped me is how to extract all the entries and get totals of each field?

I want to be able to extract and view totals for each field (eg total_for_field1,

total_for_field2, etc) and then add them all to give me the total for all. One option I had was to automatically increment the current amount with the new entry, but I would like to be able to later trace each entry.

View Replies !
Get Totals For Query
I have a table called call_event. The call_events table has colum called Time_taken. Data in this colum is stored as a decimal vaulue. EG. 4hrs and 15 minutest would be stored as 4.25.

I would like to be able to do a mysql query which give a total of all the returned values from a query but Im not quite sure what syntax I need.

The query I would like to do is to find out the the total time for a call.

I would imagen the query would be somthing like this

Query = SELECT Time_Taken FROM call_event WHERE call_id ="$call_ID";

When running this query it will return all the times_taken which have the call_id field = to $call_ID.

eg 4.5, 3.25 0.00 5.0

However what do I need to do get the total for all these values eg 4.5 + 3.25 + 0.00 + 5.00 = 12.75 I want to be do a query that will return the value of all the time_Taken added up for example in this case I wanted the query to return 12.75

Is this possible with just a query or do I need to do somthing funky with php to add up all the returned values?

View Replies !
Calculate Totals In A Loop
I am trying to calculate the totals of all the fields pulled up in a loop... i.e. I have a database called "checkout" that has bidder numbers, lot numbers, and amount for each lot number. When a person wins an auction (this is a live auction not an online auction) we enter a new row in the database that has the bidder number, the lot number, and the amount.

After the auction is complete and they are checking out we have the script pull all the rows where the bidder number equals the bidder who is paying, it displays their bidder number, and lists each lot number and amount for that lot on separate lines in a loop statement. I would like to have a final line at the end of the page that displays the total of all the amounts listed. I.e. if they have lot number 12 at $50 and lot number 10 @ $27 and lot number 55 @ $63 the script displays as follows...

bidder number: 101
lot number 12: $50
lot number 10: $27
lot number 55: $63

And I would like the end to say total: $140

How can I do this? I appreciate any help... Here is a copy of what I am working with now. Code:

View Replies !
Counting And Storing Totals
I need the $score value in the code below to be cumulative rather than just keep adding the last value and forgetting the previous total.

So, if the score is 5 and the batsmans scores 3 more, the score becomes Ǝ', and then if he scores 3 more, 11, etc... Code:

View Replies !
Adding Totals To Table Of Data
I have a table of data that is generated with a query php/mysql. I'd like to show a total for one of the columns that include dollar amounts. How would i go about doing that?

View Replies !
Calculate Totals From Repeat Region
I need some help with calculating totals from a repeat region. Some times one number sometimes ten. How can this be done.

View Replies !
Creating Totals Based On Field Input
I am trying to create a report with PHP that pulls data from a mysql database. Lets say in table called survey I have a field called zipcode, in which users fill out a form and enter their zip code. In the database the following entries have been made in the zipcode field: Code:

View Replies !
Getting MySQL SUM Values For Time Period, Ie Sum Of Totals From Date1 To Date2.
I am trying to make sales reports from a MySQL database. I have successfully made a report for 1 day, ie 2005-08-08, what I would like to do is generate a report from lets say 2005-07-08 to 2005-08-08,

I am not sure how I could write this, if it can be done. Any help or feedback would be great. The date is passed fron the URL, so I would assume that it would be $date1 = start date; $date2 = end date;

This is the code I use for one query to get totals for 1 date:

Code:
SELECT SUM(item_price*quantity) FROM invoice_items WHERE date = '$date1' AND item_type = 'Parts' AND status = 'POSTED'"

View Replies !
What Is Indexing In Mysql And How It Will Be Useful And How We Can Retrieve Database Content Easily From A Database Table Containing About 5lakhs Datas
I need to select data from a database table containing huge amount of
data. Now I am storing data using one primary key and I am just using
simple select statement, and this process gives me the output but it is
taking long to execute the query. As much I had heared I want to use
some indexing or cluster indexing which might help me but I am not so
familiar with these things.

View Replies !
Describe The Importace Of DATABASE ABSTRACTION Layers In Php And Database Connection.
Describe the importace of DATABASE ABSTRACTION layers in php and database connection.

View Replies !
Conditional Statement - Glossary Database (glos) That Can Search The Database
I'm setting up a glossary database (glos) that can search the database for '$sometext' using a form, and then prints out a list of all the words that match with their respective links. The following code works just fine. But if there are no results, I get just a blank page. I would love to get something like "Sorry but your word is not in the database" plus some extra stuff like another form to submit the new word, etc. I just don't know where or how to put in a logic script for if there are no results, do something else. Thanks for any help you can give a php newbie.

<?
$result = mysql_query(
"select * from glos where $word like '%$sometext%' order by word");
while ($i = mysql_fetch_array($result)){
print <<<END
<a href="/definition.php?word={$i['word']}">{$i['word']}</a><br>

END;
}

mysql_close();
?>

View Replies !
Automatically Update Database On Server Usign Php.e.g Mysql Database
I want to automatically update database on server usign php.e.g mysql database on web server and oracle is on local pc one php take data from the oracle and check on web server using the php and if some data is difference between oracle and mysql than that php page upload data on web server.

View Replies !
MySQL Database Backup - Restore Certain Tables Into The Database
I am stuck with a MySQLdatabase backup. Now I wish to restore certain tables into the database.

View Replies !
Images In Database Vs. Image References In Database
i kept all of the uploaded images as files on the server, and created links to them in the database. I have been changing things around now (especially directories) and I am thinking of storing the images in the actual database. I read somewhere that this can be considered a bad practice, so i was wondering what the consensus here was. In my opinion, modifying all of the code to point to the correct directories everytime a page location changes seems like a pain in the a**.

View Replies !
How To Copy A Database Or Table In A Database To My Pen Drive?
how to copy a database or table in a database to my pen drive? In which path the MYSQL database and tables will be stored?

i just wanto insert a new fieldname(column)in my table not as the last column but at the middle (say insert as 3rd fieldname) what is the MYSQL query used to alter a table with the above said condition?

View Replies !
Search A Whole Mysql Database For 1 Word In The Database
Im trying to find a way to search a whole mysql database for 1 word in the database, i assumed something like the following would work but it doesnt.

$query="SELECT * FROM database WHERE MATCH = '$searchword' ";

View Replies !
Database Search -text Database...
Can anybody tell me how to search a flat file database delimited by |. I have exploded the data and managed to get it into a table but want to restrict the final table contents by a search.

The table code at the moment is below - I'd be using a htm file to submit the data. and hopefully be able to search by partial searches eg big would return big and bigfoot. Code:

View Replies !
Update A Database Based On Another Database
I need to update a database based on another database. I can already run the php code to make the update file, but I have to remove an 'or' option at the end. This is what i have: PHP Code:

<?php
require("db_info.php");
$db=@mysql_connect("$host", "$dbuser", "$dbpass");
@mysql_select_db("$dbname");
echo("update phpbb_users set user_active="0" where");
$result=@mysql_query("SELECT * FROM members WHERE disable=1 ORDER BY rank DESC, myname");
while($row=@mysql_fetch_array($result))
echo(" username="$row[myname]" or ");
?>

I realize that i'd have to open the other database up, but I'm not sure if I have to close the first db's connection before i open the second database up.

View Replies !
Displaying Information From A Database Andinsertion Information To A Database
im trying to make it so veiw_forum.php?forumid=1 displays all the information from the database that has forumid to the value passed in the varible, but my code isnt working Code:

View Replies !
Why Are There Before Each ' In The Database?
When I enter data into the database via the webform, if I put a ' then the computer adds a so tim's becomes tim's.

Now I have had this problem before - I thought you used htmlentities to get rid of it but that doesn't seem to work any more.

The insert code is simply:

View Replies !
Php Database
I am new to php database, how to connect php database fields with user
profile files page? like if i am creating a user sign up page, and i want it to be stored on the database how do they communicate?

View Replies !
Php/database
i basically want to create two little programs. one that allows a customer to search various part numbers, and two that allows a customer to answer several questions on several different pages and returns a set result. the whole php/mysql database thing seems confusing even with the tutorials i've got.

my server is linux and everything is installed correctly but creating an actual database is the problem. it seems like you have to manually issue the commands to input each record.

View Replies !
One Database Or Many ?
If you're writing many databases that aren't necessarily associated
with each other (ie parts, vacation days, how you like your steak
done, and school you attended, etc; as examples), does it make more
sense to have one database name and several tables for the data topics
above OR multiple databases since they aren't associated with each
other?

It would SEEM easier to have a single database with multiple tables
from a data management perspective as long as there's no risk of data
integrity issues as a result of having multiple tables under one
database header

View Replies !
Database-less CMS In PHP?
Besides Pivot (I'd rather wait for the final release), EasyCMS (the
navigation bar is static), and CMSimple (all documents saved in a
single HTML, so not good for lengthy articles)... do you know of other
basic CMS written in PHP that do not require any database (ie. saves
contents as flat files)?

View Replies !
Which Database?
Which database would be the best to use with PHP. I'm looking for good performance and low costst.

View Replies !
XML And A Database
I'm confused how XML is used to benefit interaction with a database such as Oracle, MySQL or SQL Server. Are there any online resources that discuss how XML can be used with PHP to aid in database interaction? To me, it just seems that XML is its owned database structure.

View Replies !
Why Use OOP When You Have A Database?
I'm aware of the functionality of OOP. I use it quite frequently in Java (though, admittedly, I'm still not entirely accustomed to it). I think it's great for quite a few things... Thing is, that's when I don't have a database to work with. The things I have used OOP for, where I acknowledge it has been of great value to me, is when I "simulate" a database. As in linked lists (very simple database, but you get my point).

Now, when I use PHP I pretty much always have a MySQL server handy. As I see it, a MySQL table acts pretty much the same as a class would, with each row being an instance of the class, except it doesn't have methods (or functions, or whatever you prefer to call them), which are easily made for common use in PHP outside of OOP anyway. All OOP tutorials I have read have described interesting features to me, like a guestbook, which could very well be done with OOP... but could also just as well have been done with a database - and with less work.

So, my question is this:
When I have a database readily available, what advantages do I have from using OOP? If you could give an example, that'd be much appreciated (I don't mean a fully coded example... just a brief explanation of why OOP would benefit in such a system).

View Replies !
PHP Tag In Database
I have a database that consists of text. This text contains php code
that needs to be processed before echoing it on the browser. A
pseudocode may be:

<?php
/* connect to database */

/* for each record
process the php text in database */
?>

Simply echoing the text will not make the php tags to be processed.
Please let me know if you have any ideas or opinions on how to make
the text information in database to be processed.

View Replies !
Txt Database.
I am trying to figure out how to make a script that reads from a .txt file and displays data from it, liek a database.

the values is stored liek this:
440408,TH0rn,258,1,68,2853
250983,m0f0kiss,0,1,80,1072
270181,PsykoNinja,8,1,67,3103
539930,iajamo,127,1,73,2216
332802,luk3y,14,1,67,3104

Code:

View Replies !
Database
What i want to use this for is a user has a favorites column in the database. and when they click add user to favorites... it adds a name to the list in the database. or like an ID number. just so we can keep track of what users like what other users have.

then after that is in the database. i would like to be able to refer to that list in a php document that lists all the users in the list.

it sounds like a difficult process. but i just need a basic template as to how this works. i have no code written yet. or a datatable set up.

View Replies !
Sum Row In Database
I am selecting values from a postgre db and turning them into an associative array. I need to sum the total selected from a field,similar to excel's sum function.

Example- select * from tablename where date BETWEEN $date_ a AND $date_b
Output-
date: 5/26/07 code:XXXX  count:12
date: 5/27/07 code:XXXX  count:19
date: 5/28/07 code:XXXX  count:17
date: 5/29/07 code:XXXX  count:11

                            Count Total: ?

View Replies !
XML As Database
I am thinking to use XML as Database for my new PHP project. I am using PHP for editing the contents and Flash for displaying this. No, I am worrying about the problem could came when admin is editing the texts. ie, when XML file is overwriting, does this effect the front-end for a bit time? Is there any way to handle this in XML.

View Replies !
ID In A Database
I have been doing some database work and I usually just let auto_incriment start from 1 and go on... so there will be userid 1, 2, 3, etc. Is this bad for any reason? Should I start at 1000 or a number like that? I don't see any reason to start at a high number, it just seems starting at 1 is "amateur". For example, I would be suprised if there is a userid 1 on this forum. I don't know why though.

View Replies !
Database And Php
I will have to randomly divide the teams into groups, but there are some things that have to be taken into consideration. For example some of the teams will not be playing early in the morning, because they have other plans at that time.

The other thing that should be taken into concideration is which teams that has played together before in the leages. Some teams will play only one day, others will play two days. Any idea on how I should do this? How can I randomly divide the objects(teams) from the mysql table and save the groupID back into the database?

View Replies !
Different Or Same Database
I have a site on which i am using two tables> one for say articles and another for stories. There is no link between the two tables AT ALL and they are independent of each other. Also the tuples (rows) in both story and articles table varies. is should i keep both stories and articles in the same database or should i make separate db for each of them. eg db_stories and db_articles having stories and articles respectively? Does it make any difference if i use different db for each?

Also once the above thing is finalized I would like to have a common search; which will extract data from the articles and stories both stored in the db for a input by user. Is it possible? If yes please explain/elaborate and give some examples to how to implement a common search?

View Replies !
Why Do I Need A Database To Run PHP ?
I am creating a website that requires PHP. It is a website that will have ultimatly have links 100's of video files. I have been told that i should you PHP for the website to run better. I have also been told in order for me to run PHP through dreamweaver i need to set up a MySql database that connects to dreamweaver.

I have downloaded the MySql server and a program called Navicat. This all confuses me. Why do i need a database to run PHP ? What type of database & tables do i need in this database considering its a website. How do I create these tables. What program do I use to do this ?

View Replies !
Get ID From Database
I have a guestbook where the message is inserted in a database like this : PHP Code:

$sql = "insert into gaestebog(navn,epost,besked,ip,tid)
        values('$navn','$epost','$besked','$ip',now())";

Later in the file an email is sent to me like this : PHP Code:

mail($admin_epost, "Der er skrevet i din gæstebog!", $epostens_indhold);

I need the ID number from the database to be sent to me in this email.. how do I do that? I can't figure out how to get the ID number from this specific message.

View Replies !
Get From SQL Database
I currently have a list of md5 strings and need to check if a new string is in that list hundreds of thousands of times. I've found that the fastest way to do this is to have all the md5's stored in an array and use the php function in_array(). my only problem now is that populating this array with data from my sql server is rather slow, I currently use the lines:

$resone = mysql_query("SELECT * FROM logs_full");
mysql_close();

while ($row = mysql_fetch_array($resone)) {
$md5array[$md5count]= $row['textmd5'];
$md5count++;
}

to do this. does anyone have a faster method?

View Replies !
Use Database
Coming from a graphic design background. I am working a web site where i need to show thumbnail of "products" which users can add and order it. Do i need to create a database for this? I got 5 different kinds products, each category will have 30+ items. When you go to product page you choose an items.. eg. Candles, and you will be directed to a page where we you can only candles.

once users finish select the products they want, then they will be click "order now" link and will be going to product order form page. where they see all the product they chose (the can delete the products from there if they want to, or see the thumbnails) and fill the addresss and click "order now" button. and finally these info will be forwarded to my customers email id. there is no online transaction, just choose products and send the info by email. Do you think we need to have a database for this?

View Replies !
% In My Database
i was trying to insert in my database a number with % such as 20%. the fieldname is Status and set as double. i have a form wherein the user will input the percentage. however, in my database i've only seen the 20 and not 20%. how am i able to do it?

View Replies !
Database Example
I'm looking for an example of a php file that handles adding new entries, deleting entries, and modifying entries. However I'd like the entire page to be contained in one file. Let me know if you've seen one.

View Replies !
Sql Database
I havent done one of these before

echo "<select name='book_topic'>
<option value='$topic_id'>$topic_name</option>
</select>"

View Replies !
JS Pop Up Using Database
I've had my website designed in php and now want to change the way my site plays my audio files.

I would like to have a pop up player a little like the one on this site if you press play. I notice that one is a Flash Player and wondered whether that makes any difference... Obviously I would like it to open and work regardless of the users default mp3 player. Code:

View Replies !
XML V Database
I have been asked to develop a site for a recruitment company. Clearly this will hold all their job vacancies.  Now the software they use generates an XML file with approx 128 child nodes per Job node.

What is normal practice here. Would you guys keep parsing the XML with every job in it instead of using a DB or would you wite a script that checks the XML for changes and updates a DB every so often and parse the DB for your webinfo

Whats the overhead differences when it comes to processor load?

View Replies !
How To Get The Value From Database.
i have a problem regarding how to get the value from database.

<?php
$query = "Select Patient_ID from tblpatient where Patient_ID='".$_POST["Patient_ID"]."' order by Patient_ID desc limit 1;";
$result = mysql_query($query);
$row = mysql_fetch_assoc($result);
//echo $_POST['Patient_ID'];
$newPatientID = $_POST["Patient_ID"] + 1;
?>

View Replies !
CMS Using Database
Im planning to make a content management system for my site and I was thinking about doing it with flat files rather than with mysql database. The only thing is I am kinda new to flat files but Im pretty sure there is no way to edit specific lines, so If I wanted to change a page I dont know how I would do something like that.

View Replies !
Web URL From Sql Database
I am using PHP Code:

<?php
include ("../config/config.inc");

// start session and bring in session variables
session_start();
// forward to login page if the session is not valid

if(!isset($s_email))
{
        header("Location: logon.htm");     
        exit();
}

@$link = mysql_connect(SYSTEM,USERNAME,PASSWORD);

View Replies !
Exporting A Database
developed a php project using mysql as the database.i work on a win-nt machine....how do i export my database to the host server which runs linux???

View Replies !

Copyright © 2005-08 www.BigResource.com, All rights reserved