Page 1 of 1

prob with retrieving data from access

Posted: Thu Oct 27, 2005 6:06 am
by bugthefixer
I am trying to retrieve data from access and this is wat i use

Code: Select all

$rs_population = $conn->Execute("SELECT sum(total) as pop FROM tbResponseRA where (((tbResponseRA.Teshil)=$fv)) ");     
     echo $rs_shelter->Fields("shel");
Now the problem is when it couldnt find any data it prints Object id # ..... thats creating trouble for me... is there any way so that i can make it print nothing or 0 rather then Object id #

Posted: Fri Oct 28, 2005 3:31 pm
by Jean-Yves
You can use:

Code: Select all

SELECT GREATEST(SUM(total), 0) FROM table WHERE condition

Posted: Fri Oct 28, 2005 3:35 pm
by Jean-Yves
Damn, you said Access. Sorry, my code if for MySQL.

(Note to self: learn to READ!)