Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
mysql_all_create_tables_for_php
<?php
$con = new mysqli('localhost', 'root', 'pw', 'dbname');
$mysqli_result = $con->query('show tables');
$table_name_array = $mysqli_result->fetch_all(MYSQLI_BOTH);
$mysqli_result = null;
foreach ($table_name_array as $row) {
$mysqli_result = $con->query('show create table ' . $row[0]);
$create_table = $mysqli_result->fetch_array();
echo $create_table[1] . "\r\n\r\n";
$mysqli_result = null;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.