I've searched and tried several techniques to no avail. I have been trying to make a table that will show information from my database. I can successfully connect to the database, but I cannot pull any information and display it. Could someone tell me where im going wrong? Here is my code:
<?php
$servername = "localhost";
$username = "";
$password = "";
$dbname = "";
$conn = new mysqli($servername, $username, $password, $dbname);
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql = mysql_query("SELECT * FROM siege-leaderboard");
$result = $conn->query($sql);
if ($result->num_rows > 0) {
echo "<table><tr><td>1</td><tdp>2</td><td>3</td><td>4</td><td>5</td></tr>";
while($row = $result->mysql_fetch_assoc()) {
echo "<tr><td>".$row["1"]."</td><td>".$row["2"]."</td><td>".$row["3"]."
</td><td>".$row["4"]."</td><td>".$row["5"]."</td></tr>";
}
echo "</table>";
} else {
echo "0 results";
}
$conn->close();
?>
I have also tried : while($row = $result->fetch_assoc()) and while($row = $result->mysql_fetch_array())\ With same results. Basically the code says "0 results" but theres information in the table, so im not sure whats happening =/