setAttribute(PDO::ATTR_EMULATE_PREPARES, TRUE); $dbh->setAttribute(PDO::ATTR_ERRMODE,PDO::ERRMODE_EXCEPTION); // Escape the value of $author with quote() $sql="SELECT * FROM vsaqtns WHERE sbj='$sbj'"; //qnatr; // Execute the statement and echo the results $results = $dbh->query($sql)->fetchAll(PDO::FETCH_ASSOC); //---------------- echo json_encode($results); //$dbh = null; } catch (PDOException $e) { print "Error!: " . $e->getMessage() . "
"; die(); } ?>