this is probably a simple question and I've searched but not sure of what the official description is of what I want to do....
I've a table recording details of buildings with columns recording, yes no or not recorded against things such as broadband, telephone etc...
I'm trying to build a query which returns each value, a bit like a report, but want to keep things where I'm not running an individual query for each value (Remembering DRY!).
If I know I'm looking for either "yes", "no" or "not recorded", is it possible to do one query to return all 3 values separately?
i only currently know how to return individual values and I don't want to create a page full of repeated code!
Table: sites (excuse the poor layout!)
:ID--SITE----------------BBAND----PHONE
:1---Station House-----Yes---------Yes
:2---Drakes Building---Yes---------No
:3---Summer Lodge----No----------Yes
:4---Prospect House---Yes--------Yes
current code is (i don't know how to do multiple counts):
$result=mysql_query("SELECT count(*) as bband from sites WHERE bband = 'Yes'");
$data=mysql_fetch_assoc($result);
echo "Broadband Yes:";
echo $data['bband'];
I'd then have to repeate this code for 'No' and then again for 'Not Recorded'. That method is wrong as its very inefficient.
Ideally I'd like to be able to echo/print the individual results so I can add them to a table/layout .