Skip to content

Instantly share code, notes, and snippets.

Created September 9, 2010 11:31
Show Gist options
  • Save anonymous/571753 to your computer and use it in GitHub Desktop.
Save anonymous/571753 to your computer and use it in GitHub Desktop.
<?php
class db{
public function connect(){
global $dbhost,$dbname,$dbuser,$dbpassword;
$mysqli = new mysqli($dbhost, $dbuser, $dbpassword, $dbname);
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
}
public function close(){
$mysqli->close();
}
} /*** end of class ***/
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment