function getTests($id) {
$sql = "SELECT * FROM tests WHERE guid='$id'";
try {
$sql = "SELECT * FROM questions WHERE testid='$id'";
!!!
$query = $wpdb->get_results('SELECT * FROM `'.mysql_real_escape_string($wpdb->posts).'` INNER JOIN `'.mysql_real_escape_string($wpdb->postmeta).'` ON `'.mysql_real_escape_string($wpdb->posts.id).'` = '.(int)$wpdb->postmeta.post_id);