|
PHP селектирање и приказ на податоци од табела
<?php
$servername = "localhost";
$username = "username";
$password = "password";
$dbname = "mojaDB";
$conn = new
mysqli($servername, $username, $password, $dbname);
if ($conn->connect_error)
{
die("Neuspesna
konekcija: " . $conn->connect_error);
}
$sql = "SELECT id, ime,
prezime FROM Ucenici";
$result = $conn->query($sql);
if ($result->num_rows
> 0) {
while($row =
$result->fetch_assoc()) {
echo
"id: " . $row["id"].
" - Ime: " . $row["ime"].
" " . $row["prezime"].
"<br>";
}
} else {
echo
"Nema podatoci ";
}
$conn->close();
?>
|
|