Skip to content

Instantly share code, notes, and snippets.

Created February 20, 2017 16:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/d58a554d6c132a2e80dba5163f4d240c to your computer and use it in GitHub Desktop.
Save anonymous/d58a554d6c132a2e80dba5163f4d240c to your computer and use it in GitHub Desktop.
<?php
header('Content-type: application/json');
require_once "connect.php";
$polaczenie = @new mysqli($host, $db_user, $db_password, $db_name);
if (mysqli_connect_errno())
{
echo 'Błąd';
exit;
}
else {
}
$zapytanie_pobierz = "SELECT * FROM czat";
$wynik_pobierz = mysqli_query($polaczenie, $zapytanie_pobierz);
$pobrane_dane = array();
while ($wiersz = mysqli_fetch_row($wynik_pobierz)){
$pobrane_dane[] = $wiersz;
}
echo json_encode($pobrane_dane);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment