Skip to content

Instantly share code, notes, and snippets.

@malikkurosaki
Created February 13, 2018 03:52
Show Gist options
  • Save malikkurosaki/c0f3d431be38788f25639e4be0c477be to your computer and use it in GitHub Desktop.
Save malikkurosaki/c0f3d431be38788f25639e4be0c477be to your computer and use it in GitHub Desktop.
show all table name from database
<?php
requere("../core/connaect.php"); // connetion of database "host,user,pass,db" wrap as $con;
$query = "SHOW TABLES FROM mydb"; // the query
$result = mysqli_query($con,$query); // check is database have table
if($result){
echo "ok";
$rows = mysqli_fetch_all($result); // fetch all
print_r($rows); //output name of tables
}else{
echo $con->error;
}
$con->close(); // close connection from database
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment