sum() function problem

wxdqz

New Member
Hi
I am using the sum function in the MySQL query. The query runs fine and shows the output which is required by when i am using this query to extract data through a web page, it shows blank fields rather than showing a value.

I am attaching the code below:
*******************
$querys= mysql_query("select sum(table.field) as display from table1, table2 where table1.a = table2.a And group by table.field;");
if (!$querys) {
echo("</table>");
echo("<P>Error retrieving values from the database!<BR>".
"Error: " . mysql_error());
// exit();
}while ($query= mysql_fetch_array($querys)) {
$query = $querys["display"];
echo("$query \n");
}
*********
There is no display on the page. But When i run the query in normal sql mode, i see the result which is the sum of all values in the field

Thanks in advance

Nikhil Dighe
 
Back
Top