I'd like to draw data from a table in my mysql, and put the data into a customized table. I would like to have the info into the table as http://gyazo.com/c6a40fcd6e4edc66f7f11650f641dae2. However when I'm trying it turns out very bad. Heres my coding.
<?php
$servername = "#";
$username = "#";
$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 minecraft_user, service FROM votes";
$result = $conn->query($sql);
echo '<div class="grid-40 vote-leaderboard"> <h3><i class="fa fa-star"></i>Recent Votes</h3> <table class="top-voters"> <tbody>';
if ($result->num_rows > 0) {
// output data of each row
while($row = $result->fetch_assoc()) {
echo '<tr><td>' . $row[minecraft_user]. '</td><td>' . $row[service]. '</td></tr><br>';
}
} else {
echo "No recent votes!";
}
echo '</tbody>';
$conn->close();
?>
Can someone please help me with this? I've been testing for hours with no result.