Skip to content

Instantly share code, notes, and snippets.

@lfalmeida
Created March 29, 2015 01:46
Show Gist options
  • Save lfalmeida/62e6d3efbd5cb1dd8dd2 to your computer and use it in GitHub Desktop.
Save lfalmeida/62e6d3efbd5cb1dd8dd2 to your computer and use it in GitHub Desktop.
Usando PDO com codeigniter
<?php
$pdo = new PDO('mysql:host=localhost;dbname=itlean', $this->db->username, $this->db->password);
$username = 'itlean';
$consulta = $pdo->prepare("SELECT * FROM admin_users WHERE username = :username;");
$consulta->bindParam(':username', $username, PDO::PARAM_STR);
$consulta->execute();
while ($linha = $consulta->fetch(PDO::FETCH_OBJ)) {
print_r($linha);
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment