Retrieve data from a table || Get value from database php

<?php

$con=mysqli_connect("localhost","admin","abc123","mydb");
// Check connection
if (mysqli_connect_errno())
  {
  echo "Failed to connect to MySQL: " . mysqli_connect_error();
  }
$result = mysqli_query($con,"SELECT * FROM users");

while($row = mysqli_fetch_array($result))
  {
  $display = $row['firstname'];
  echo"$display";
  }
  
mysqli_close($con);

?>

About the Author

Expert writer helping professionals grow their knowledge through well-researched content and strategic insights.

Read the previous article
Read the next article

Popular Posts