Skip to content

Instantly share code, notes, and snippets.

@ClaudioHenrique
Created January 2, 2015 23:19
Show Gist options
  • Save ClaudioHenrique/2a047f230c7e255af8f4 to your computer and use it in GitHub Desktop.
Save ClaudioHenrique/2a047f230c7e255af8f4 to your computer and use it in GitHub Desktop.
Consulta ao Banco.
function search($id){
$sql = "SELECT id,value,type FROM mt_type WHERE fk_questao = :id";
try{
$db = getConnection();
$stmt = $db->prepare($sql);
$stmt->bindParam('id',$id);
$stmt->execute();
$result = $stmt->fetchAll(PDO::FETCH_ASSOC);
}catch(PDOException $e){
echo $e->getMessage();
}
echo json_encode($result);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment