can i execute a SQL file with PHP?

Codes here !

Moderators: macek, egami, gesf

Post Reply
Jay

Post by Jay » Wed Aug 14, 2002 2:52 am

You can't execute a file as it stands, but you can read the file, split it down into the appropriate sentences and execute them individually.

DoppyNL

Post by DoppyNL » Wed Aug 14, 2002 3:10 am

you can take a look at phpmyadmin, because it is possible to execute the query's in an sql-file with phpmyadmin.
So you can take a look at how they did it.

Greetz Daan

Jay

Post by Jay » Wed Aug 14, 2002 3:44 am

dvdbinternet wrote:you can take a look at phpmyadmin, because it is possible to execute the query's in an sql-file with phpmyadmin.
So you can take a look at how they did it.

Greetz Daan

I already deciphered it, they spilt the query up into single commands and execute them individually.

You'll notice once you execute a file in PHPMyAdmin it'll tell you how many commands were executed.

serge
New php-forum User
New php-forum User
Posts: 14
Joined: Mon Sep 16, 2002 1:25 am
Location: Ukraine
Contact:

Post by serge » Fri Sep 20, 2002 7:59 am

For instance, sql script is "script.sql."
U can use:

exec('mysql < script.sql') in local variant

or specify command line parameters (for help: 'mysql --h') - sever, username, password, etc in case of remote mysql server.

------------------------
With best regards,
Serge Bulanov
AlarIT Web developer,
http://www.AlarIT.com

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests