Last active
October 27, 2018 02:54
-
-
Save lf-uraku-yuki/0967f9efa7e086202a5a486d19dd8ea9 to your computer and use it in GitHub Desktop.
mysql_all_create_tables_for_php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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