<!DOCTYPE html>
<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<title>Untitled 1</title>
</head>
<body>
<?php
$host = "localhost";
$username = "root";
$password = "";
$dbname = "mshop";
// Create connection
$conn = new mysqli($host, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$conn->set_charset("utf8"); // Enable to write in phpMyAdmin in Hebrew
$sql = "SELECT * from mytable";
$result = $conn->query($sql);
if ($result->num_rows > 0) { // output data of each row
while($row = $result->fetch_assoc()) {
echo "pid: " . $row["pid"]. " - pName: " . $row["pname"]."<br>";
}
} else {
echo "0 results";
}
$result->free();
$conn->close();
?>
</body>
</html>