Tuesday, 13 August 2013

Display information from MySQL Database on webpage

Display information from MySQL Database on webpage

<h1>Matches</h1>
<?php
$con=mysqli_connect("localhost","root","","esports");
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$result = mysqli_query($con,"SELECT * FROM NA");
while($row = mysqli_fetch_array($result))
{
echo $row['team1'] . " vs. " . $row['team2'];
echo "<br>";
}
mysqli_close($con);
?>
I'm trying to use this to get information from my MySQL Database and then
display it onto a webpage using an HTML Table. I'm kind of new to this, so
how would I go about doing this? Any help is appreciated.

No comments:

Post a Comment