This question already has an answer here:
After migrating from localhost to webserver I'm getting this error. Maybe it could be because of the PHP version on webserver (PHP 5.2). Any ideas?
<?php
$servername ="";
$username ="uran";
$password ="";
$dbname ="";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql = "SELECT * FROM answer WHERE topic_key='$id'";
$result = $conn->query($sql);
// output data of each row
while($row = $result->fetch_assoc()) {
echo "<strong>Príspevok č.:</strong> " . $row["id"]. "<br>"." <strong>Napísal:</strong> "
. $row["name"]. "<br>". $row["topic"]."<br>" . $row["reg_date"]."<br>"." <br><br>";
}
$conn->close();
?>
</div>