Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

Displaying all table names in php from MySQL database


$servername = "localhost";
$username = "root";
$password = "";
$dbname = "dbms";

$conn = new mysqli($servername, $username, $password, $dbname);
$sql = "show tables LIKE '%student%'";

$result = mysqli_query($conn, $sql); // run the query and assign the result to $result
while($table = mysqli_fetch_array($result)) { // go through each row that was returned in $result
    echo($table[0] . "<BR>");    // print the table that was returned on that row.

}
 
PREVIOUS NEXT
Tagged: #Displaying #table #names #php #MySQL #database
ADD COMMENT
Topic
Name
9+9 =