Re: [PHP-DB] Adding up the RESULT
On Thursday 18 April 2002 00:08, Joel Colombo wrote: i was wondering about a PHP function like mysql_fetch_array but that would select all the ROW values of one FIELD rather the mysql_fetch_array selecting all FIELDS of ONE row. does PHP have that function ? Not yet. basically y do i need that ? You don't :) because i am selecting a number of rows from my table from 1 to 35000 at a time i need the SUM of one field based on the ROWS selected but... no GROUP BY because the table has 2 fields: index, and fieldname Why not do it in the database? SELECT SUM(price) FROM products; i have also posted this question in mailing.database.mysql but the traffic in that group has been too light... and posted to alt.php.sql but i will take any suggestions from any group on this one... How about the MySQL mailing list? -- Jason Wong - Gremlins Associates - www.gremlins.com.hk Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* MSDOS didn't get as bad as it is overnight -- it took over ten years of careful development. (By [EMAIL PROTECTED]) */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Adding up the RESULT
ok i thought the SUM only worked with GROUP BY shit... that makes me feel stupid but smarter now thanx Joel Jason Wong [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED]... On Thursday 18 April 2002 00:08, Joel Colombo wrote: i was wondering about a PHP function like mysql_fetch_array but that would select all the ROW values of one FIELD rather the mysql_fetch_array selecting all FIELDS of ONE row. does PHP have that function ? Not yet. basically y do i need that ? You don't :) because i am selecting a number of rows from my table from 1 to 35000 at a time i need the SUM of one field based on the ROWS selected but... no GROUP BY because the table has 2 fields: index, and fieldname Why not do it in the database? SELECT SUM(price) FROM products; i have also posted this question in mailing.database.mysql but the traffic in that group has been too light... and posted to alt.php.sql but i will take any suggestions from any group on this one... How about the MySQL mailing list? -- Jason Wong - Gremlins Associates - www.gremlins.com.hk Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* MSDOS didn't get as bad as it is overnight -- it took over ten years of careful development. (By [EMAIL PROTECTED]) */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php