[advanced search]
Results from the most recent live auction are here.
20 members in the live chat room. Join Chat!
Register Rules & FAQ NP$ Store Active Threads Mark Forums Read
Go Back   NamePros.Com > Design and Development > Programming > CODE
User Name
Password

Old 10-05-2006, 10:47 AM   · #1
Barrucadu
Formally Mikor.
 
Barrucadu's Avatar
 
Name: Michael Walker
Location: East Yorkshire, England
Trader Rating: (7)
Join Date: Aug 2005
Posts: 2,438
NP$: 95.25 (Donate)
Barrucadu is a splendid one to beholdBarrucadu is a splendid one to beholdBarrucadu is a splendid one to beholdBarrucadu is a splendid one to beholdBarrucadu is a splendid one to beholdBarrucadu is a splendid one to beholdBarrucadu is a splendid one to behold
MySQL Dump Script

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

PHP Code:
<?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
'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;`'.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++;
}
?>


Please register or log-in into NamePros to hide ads
__________________
Me | Blog | Last.fm | F@h

archlinux User
Barrucadu is offline   Reply With Quote
Closed Thread

NamePros is a revenue sharing forum.

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


Site Sponsors
http://www.internetinvestments.com/ Proof is in the Parking Thousand Dollar Profits
Advertise your business at NamePros
All times are GMT -7. The time now is 05:21 AM.


Powered by: vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.0