Displaying all table names from MySQL database using php



<?php
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "drupal8";

// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
 
$sql = "SHOW TABLES FROM $dbname"; 

$result=mysqli_query($conn,$sql);

while ($row = $result->fetch_row()) { 
  print '<pre>';
  print $row[0];
  print '</pre>';
}
?>



Related Post


Latest Post


Recent Posts Widget

Make sure to never miss a thing...

Get the latest news from the creative industry along with other creative goodies, conveniently delivered to social media.