So how do I get this to work then, it isn't working as it is?
$directory = "SELECT DISTINCT substring(postcode,0,2) AS postie, COUNT(*) AS count FROM searchpost GROUP BY postie ORDER BY count desc";
My database is like this:
postcode
dg1 4gh
dg4 5th
wa1 5dj
wa2 4dj
rt1 5gh
wa3 8th
I want to echo the results for the above like so:
dg - 2
wa - 3
rt - 1
Hope you can advise/help.
Thanks.