RE: [PHP-DB] Loading database information from a text file

2003-06-07 Thread John W. Holmes
> I have a text file with all my database information
> from creating databases to setting up tables.  I have
> looked throught the mysql docs on how to load these on
> from a text file via the mysql prompt.  But all I can
> find is:
> 
> load data infile "filename.txt" into table whatever
> 
> But this is not what I am looking for. :(  As the
> tables are already defined in the text file and the
> appropiate database name to enter them into.
> 
> Is there a way to load these into the database
> directly instead of doing each table seperately from
> the mysql prompt? (not web admin)

Is this a mysqldump file? The file has all of the SQL statements that
you need to run? If so, just send it to mysql...

Mysql -uuser -ppassword database_name < filename.txt

You can call that through exec() if you want. The file must be proper
SQL, though. 

---John W. Holmes...

Amazon Wishlist: http://www.amazon.com/o/registry/3BEXC84AB3A5E

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] Loading database information from a text file

2003-06-07 Thread JeRRy
Hi,

I have a text file with all my database information
from creating databases to setting up tables.  I have
looked throught the mysql docs on how to load these on
from a text file via the mysql prompt.  But all I can
find is:

load data infile "filename.txt" into table whatever

But this is not what I am looking for. :(  As the
tables are already defined in the text file and the
appropiate database name to enter them into.

Is there a way to load these into the database
directly instead of doing each table seperately from
the mysql prompt? (not web admin)

Thanks in advance.

Kind Regards,
Jerry


http://mobile.yahoo.com.au - Yahoo! Mobile
- Check & compose your email via SMS on your Telstra or Vodafone mobile.

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php