Re: Import .sql file via PHP
- From: Tim Van Wassenhove <timvw@xxxxxxxxxxxxxxxxxxxxx>
- Date: Mon, 30 May 2005 10:24:05 +0000 (UTC)
On 2005-05-30, Jamie Meyers <gtg061q@xxxxxxxxxxxxxxx> wrote:
> Nevermind, I decided to parse the .sql file and create the query there. I
> do not think there is any way to import the .sql file via php. Thanks
> anyways. And if anyone would like this script after I fix it up a little
> more, let me know.
Assuming each instruction is on a line.. (untested)
$db = mysql_connect(....);
mysql_select_db(....);
$fp = fopen('somefile.sql', 'r');
while($fp != feof())
{
$line = fread($fp, 2048);
$line = mysql_real_escape_string($db, $line);
mysql_query($line);
}
fclose($fp);
--
Met vriendelijke groeten,
Tim Van Wassenhove <http://timvw.madoka.be>
.
- Follow-Ups:
- Re: Import .sql file via PHP
- From: Ivan Omelchenko 608308824
- Re: Import .sql file via PHP
- References:
- Import .sql file via PHP
- From: Jamie Meyers
- Re: Import .sql file via PHP
- From: Stephen Harris
- Re: Import .sql file via PHP
- From: Jamie Meyers
- Import .sql file via PHP
- Prev by Date: Opnion needed on image manipulation (not neccesarilly PHP)
- Next by Date: Re: get output from ssh2_shell
- Previous by thread: Re: Import .sql file via PHP
- Next by thread: Re: Import .sql file via PHP
- Index(es):
Relevant Pages
|