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.
For the record, here's sample code for fixing this hole.
$allowed_tables = array('table1', 'table2'); $clas = $_POST['clas']; if (in_array($clas, $allowed_tables)) { $query = "SELECT * FROM `$clas`"; }