RE: [PHP-DB] Executing Queries from a File Using PHP
| From: | Jeffrey_N_Dyke at Keane dot com | Date: | Thu, 13 Jun 2002 13:36:06 +0000 |
| Subject: | RE: [PHP-DB] Executing Queries from a File Using PHP | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-19785@lists.php.net to get a copy of this message | ||
although this goes without saying but in my petty need for completion, i
feel i must write....there is obviously SO much more that can be done where
i put the mysql_query($qry), whether it be updating, inserting, selecting
etc... but that can be a starting point.
i feel better, thank you for your indulgence. :)
----- Forwarded by Jeffrey N Dyke/CORP/Keane on 06/13/2002 09:30 AM -----
Jeffrey N Dyke
To: <brucev@cyberlink.com>
06/13/2002 cc: php-db@lists.php.net
09:00 AM Subject: RE: [PHP-DB] Executing Queries from a File
Using PHP(Document
link: Jeff Dyke)
all you have to do is put one query per line in the file, it may be hard to
read, but who cares.
and then it is as simple as.
$contents = file("sql.txt"); //file function reads file into array
while (list ($qry)) = each($contents)) {
mysql_query($qry);
}
Just a thought....
Jeff
"Bruce Vander
Werf" To: <php-db@lists.php.net>
<brucev@cyberl cc:
ink.com> Subject: RE: [PHP-DB] Executing Queries from a File
Using PHP
06/13/2002
08:39 AM
Please respond
to brucev
Thanks. Since it would take me forever to write, and I don't know thing
well
enough to make sure I have all the possibilities covered, I was hoping
there
was some source code somewhere I can use.
--Bruce
-----Original Message-----
From: Jason Wong [mailto:phplist@gremlins.com.hk]
Sent: Wednesday, June 12, 2002 11:34 PM
To: php-db@lists.php.net
Subject: Re: [PHP-DB] Executing Queries from a File Using PHP
On Thursday 13 June 2002 10:48, Bruce Vander Werf wrote:
> Is there a PHP routine anywhere to execute a series of MySQL queries in a
> text file?
>
> I know how to do this via the command line or by using PHPMyAdmin, but I
> need to do it in my own PHP script, and some of the queries span more
than
> one line.
There are no built-in functions to do so. You need to read in the file
yourself, parse it appropriately then send the queries to mysql.
--
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
/*
Thank you for observing all safety precautions.
*/
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php