I've the following script (taken from a large script) saved as example3.php:
<script type="text/javascript">
var layer;
//where layer is a table like
------------------------------------
BUSNAME + Category +
------------------------------------
200 Bay + Restaurant +
201 Bay + Bank +
202 Bay + School +
203 Bay + Restaurant +
204 Bay + School +
205 Bay + Restaurant +
206 Bay + Restaurant +
207 Bay + School +
208 Bay + Restaurant +
209 Bay + Restaurant +
------------------------------------
window.location.href = "example3.php?layer="+ layer;
<?php
//Make a MySQL Connection
$query = "SELECT Category, COUNT(BUSNAME)
FROM ".$_GET['layer']." GROUP BY Category";
$result = mysql_query($query) or die(mysql_error());
//Print out result
while($row = mysql_fetch_array($result)){
echo "There are ".$row['COUNT(BUSNAME)']. " " .$row['Category']. "items.";
echo "<br/>";
}
?>
</script>
Don't no why it is not working. Any suggestion must be appreciated.