Hi Jay,
you suggestion does not make any difference. The problem is that @idsum seems to be destroyed for every row! Is there any other access method on a query that works properly or do I have to live with different results of the very same query asked directly in MySQL and asked through PHP? Timo Am Montag den, 9. September 2002, um 15:04, schrieb Jay Blanchard: > [snip] > 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 > 'id': > 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: > [/snip] > > 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; > > HTH! > > Jay > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php