Skip to content

Instantly share code, notes, and snippets.

@oneberto
Created January 29, 2018 15:54
Show Gist options
  • Save oneberto/13e8d969670a0ebb11a37650bf2f9338 to your computer and use it in GitHub Desktop.
Save oneberto/13e8d969670a0ebb11a37650bf2f9338 to your computer and use it in GitHub Desktop.
<?php
$servidor = 'localhost';
$usuario = 'root';
$senha = '';
$banco = 'mydb';
$mysqli = new mysqli($servidor, $usuario, $senha, $banco);
// Executa
$sql = "SELECT * FROM dados";
$query = $mysqli->query($sql);
while ($dados = $query->fetch_array()) {
echo 'ID: ' . $dados['id'] . '';
echo 'Texto: ' . $dados['texto'] . '';
}
echo 'Registros encontrados: ' . $query->num_rows;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment