Skip to content

Instantly share code, notes, and snippets.

@zerobugs-oficial
Created June 18, 2020 23:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save zerobugs-oficial/2b1401935f4637560828edbc90f6e843 to your computer and use it in GitHub Desktop.
Save zerobugs-oficial/2b1401935f4637560828edbc90f6e843 to your computer and use it in GitHub Desktop.
Conectar site PHP ao banco de dados MYSQL com mysqli
<?php
$hostname = "localhost";
$bancodedados = "bancodedados";
$usuario = "usuario";
$senha = "senha";
$mysqli = new mysqli($hostname, $usuario, $senha, $bancodedados);
if ($mysqli->connect_errno) {
echo "Falha ao conectar: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error;
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment