How to display MySQL data using PHP

Home > Search > How-to
  by

The following PHP code is used to select data from a MySQL table and to then display the data in a Web browser.

<?php 
$con = new mysqli('ip_or_domain','username','password','database'); 
$select = "SELECT * FROM tablename"; 
$query = mysqli_query($con, $select);

while ($row = mysqli_fetch_array($query)) {
echo $row['columnname'];
}

?>

 



Add a Comment




We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.




Please enter in the box below so that we can be sure you are a human.




Comments