You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
691 B
29 lines
691 B
<?php
|
|
$servername = "localhost";
|
|
$username = "root";
|
|
$password = "toor";
|
|
$dbname = "wtl";
|
|
|
|
// Create connection
|
|
$conn = mysqli_connect($servername, $username, $password, $dbname);
|
|
|
|
// Check connection
|
|
if (!$conn) {
|
|
die("Connection failed: " . mysqli_connect_error());
|
|
}
|
|
|
|
$sql = "SELECT * FROM kniha";
|
|
$result = mysqli_query($conn, $sql);
|
|
|
|
if (mysqli_num_rows($result) > 0) {
|
|
while($row = mysqli_fetch_assoc($result)) {
|
|
echo "<p> id: <b>" . $row["id"] . "</b>";
|
|
echo " name: <b>" . $row["name"] . "</b>";
|
|
echo " email: <b>" . $row["email"] . "</b>";
|
|
echo " text: <b>" . $row["text"] . "</b>";
|
|
echo "</p>";
|
|
}
|
|
} else {
|
|
echo "0 results";
|
|
}
|
|
?>
|