- Impact
- 64
This script returns the table structures of every table in every database.
To use just edit the variables at the top of the script.
If you find any bugs tell me. And yes, I will make it dump table contents sometime, lol
To use just edit the variables at the top of the script.
If you find any bugs tell me. And yes, I will make it dump table contents sometime, lol
PHP:
<?php
set_time_limit(0);
$db['host'] = '';
$db['user'] = '';
$db['pass'] = '';
function error($error_msg){
die('<script>
alert("An error occured!");
alert("'.$error_msg.'");
</script>');
}
mysql_connect($db['host'],$db['user'],$db['pass'])or error(mysql_error());
$databases = mysql_query('SHOW DATABASES;')or error(mysql_error());
$i=0;
while($i<mysql_num_rows($databases)){
mysql_select_db(mysql_result($databases,$i));
$tables=mysql_query('SHOW TABLES;')or error(mysql_error());
echo 'CREATE DATABASE `'.mysql_result($databases,$i).'`<br />';
$i2=0;
while($i2<mysql_num_rows($tables)){
$fields=mysql_query('DESCRIBE `'.mysql_result($tables,$i2).'`;')or error(mysql_error());
echo 'CREATE TABLE `'.mysql_result($tables,$i2).'`(<br />';
$i3=0;
while($i3<mysql_num_rows($fields)){
echo ' `'.mysql_result($fields,$i3,'field').'` '.mysql_result($fields,$i3,'type');
if(mysql_result($fields,$i3,'null') != 'NULL'){
echo ' NOT NULL';
if(mysql_result($fields,$i3,'default') != ''){
echo ' DEFAULT \''.mysql_result($fields,$i3,'default').'\'';
}
}else{
echo ' DEFAULT NULL';
}
echo '<br />';
$i3++;
}
echo ')<br /><br />';
$i2++;
}
$i++;
}
?>









