I would like to be able to sum up a collumns values already in 
MySQL. The following query will sum up all values of the column 
SELECT @idsum:=(IFNULL(@idsum, id)+id), id FROM yourtable;

Now a question to the PHP/MySQL experienced: Why does this type 
of query not work in combination with PHP? I am using query 
above as $query and do the following standard procedure:

Good point! Now as to your question, try this...

SELECT @idsum:=(IFNULL(@idsum, id)+id) AS idsum, id FROM yourtable;

When you output your query info output the value as $row->idsum;



PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to