Pull database info and display to html problem?

I'm trying to display the information from the database to the html page but it is only displaying the message "connected successfully". The name of the database is "admin" and the table within that database is called "users". I have no idea how to get past the message and just display the table I have created.

Index page (index.php):

$query="select * from users";
<!DOCTYPE html>
    <head> Fetch Data Frome Database</head>

<table align=“center” border=“1px” style=“width:250px; line-height: 30px;”>
<th colspan=“4”><h2>Account Record</h2></th>



    &lt;td&gt;&lt;?php echo $rows['ID'];?&gt;&lt;/td&gt;
    &lt;td&gt;&lt;?php echo $rows['username'];?&gt;&lt;/td&gt;
    &lt;td&gt;&lt;?php echo $rows['password'];?&gt;&lt;/td&gt;




CONNECTION PAGE (connection.php):

//Include your own values for username, password and dbase name

$host = “localhost”;
$username = “root”;
$password = “root”;
$dbname = “admin”;

// Create connection
$conn = new mysqli($host, $username, $password, $dbname);

// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
echo “Connected successfully”;

#php #html #mysql #database

1 Likes1.50 GEEK