I had this discussion with a high reputation PHP guy:
PDO has no use here. as well as mysql_real_escape_string. extremely poor quality.
This of course is cool, but I honestly don't know what's wrong with suggesting use of mysql_real_escape_string
or PDO to fix this code:
<script type="text/javascript">
var layer;
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());
Into this
$layer = mysql_real_escape_string($_GET['layer']);
$query = "SELECT Category, COUNT(BUSNAME)
FROM `".$layer."` GROUP BY Category";
, considering that the JavaScript code gets send client-side.