// Connect to MySQL database $conn = mysqli_connect("localhost", "username", "password", "database"); // Query to retrieve data from table $query = "SELECT * FROM table WHERE id = 1"; // Execute query $result = mysqli_query($conn, $query); // Retrieve row using fetch_row() $row = mysqli_fetch_row($result); // Display data from row echo "Name: " . $row[1] . "
"; echo "Age: " . $row[2] . "
"; echo "Email: " . $row[3] . "
";
// Connect to MySQL database $conn = mysqli_connect("localhost", "username", "password", "database"); // Query to retrieve data from table $query = "SELECT * FROM table"; // Execute query $result = mysqli_query($conn, $query); // Loop through result set and retrieve each row using fetch_row() while ($row = mysqli_fetch_row($result)) { // Display data from row echo "Name: " . $row[1] . "Package/Library: MySQL Improved Extension (mysqli) in PHP.
"; echo "Age: " . $row[2] . "
"; echo "Email: " . $row[3] . "
"; }