[PHP-DB] pulling numbers from a column and getting a total

2006-07-26 Thread Dave W
Hi, I was just wondering on how I could get a whole column full of integers and added them up and display that total? I currently use a for loop to display the whole column in a table, but I wanted to add all those numbers up. Thanks. -- Dave W

Re: [PHP-DB] pulling numbers from a column and getting a total

2006-07-26 Thread Natalie Leotta
http://www.techonthenet.com/sql/sum.php That should help, Dave! Natalie On 7/26/06, Dave W [EMAIL PROTECTED] wrote: Hi, I was just wondering on how I could get a whole column full of integers and added them up and display that total? I currently use a for loop to display the whole column in

Re: [PHP-DB] pulling numbers from a column and getting a total

2006-07-26 Thread Natalie Leotta
I just reread your question and realized that you said you're already displaying each number, so instead you might be better off with a variable that you initialize to 0 and then in each iteration of your for loop add on that value. Natalie On 7/26/06, Natalie Leotta [EMAIL PROTECTED] wrote:

Re: [PHP-DB] pulling numbers from a column and getting a total

2006-07-26 Thread Dave W
Thanks Natalie and Miles! The loop thing worked. What I had tried before was put the echo inside the loop and it wasn't working, but now it does, w00t! Thanks! On 7/26/06, Miles Thompson [EMAIL PROTECTED] wrote: At 10:27 AM 7/26/2006, Dave W wrote: Hi, I was just wondering on how I could get

[PHP-DB] Column names into variables

2006-07-26 Thread z
Hi, I have a table with about 50 columns in it. I'd like to query the information for one record, and hold the data in variables that have the same name as the column headings, along these lines: $query = Select * from `postings` where `id` = $userid; $result = mysql_query($query);

Re: [PHP-DB] Column names into variables

2006-07-26 Thread Ben Hatfield
I believe this does exactly what you want. http://us3.php.net/extract Ben Hatfield Programmer [EMAIL PROTECTED] Soapbox Studio, Inc. 469 N. Lake Street Mundelein, IL 60060 P: +1.847.566.0666 x6# www.soapboxstudio.com On Jul 26, 2006, at 12:14 pm, z wrote: Hi, I have a table with about 50