For that MySQL team designed the Mysql client to get input from file and
execute it.

do
system ( "mysql < sql.fie");
or
`mysql < sql.fie`;

dont forget to use -D and -p if User is required.

----- Original Message -----
From: "lallous" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, August 14, 2001 1:29 PM
Subject: Re: [PHP] PHP: mysql_query()


> No actually I have a .SQL file that is a complete dump of my database.
> All i want to do is the execute with mysql_query() the whole .SQL which
will
> create databases and tables and fillin fields!
>
> "Ben-Nes Michael" <[EMAIL PROTECTED]> wrote in message
> 004701c124a0$e690c860$[EMAIL PROTECTED]">news:004701c124a0$e690c860$[EMAIL PROTECTED]...
> > You cant do this.
> >
> > Its even recommended to drop the `;' from the end of the sql command.
> >
> > You can go around using array to store the sql statements and use
foreach
> to
> > run mysql_query with thee sql statement.
> >
> > But I don't think its right way to do thing !
> >
> > If you intention was to do update one after other then you should use
> locks
> > or use Postgres :)
> >
> > --------------------------
> > Canaan Surfing Ltd.
> > Internet Service Providers
> > Ben-Nes Michael - Manager
> > Tel: 972-4-6991122
> > http://sites.canaan.co.il
> > --------------------------
> >
> > ----- Original Message -----
> > From: "lallous" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Tuesday, August 14, 2001 12:59 PM
> > Subject: [PHP] PHP: mysql_query()
> >
> >
> > > Actually the mysql_query() seems to accept only one statement at a
time.
> > >
> > > Any work around so i can do query suchs:
> > >
> > > mysql_query("
> > > SELECT 1+1;
> > > SHOW DATABASES;
> > > USE database1;
> > > SELECT * FROM table1;
> > > ");
> > >
> > > Just multiple commands seperated with ';' ? (as if using the Mysql
> command
> > > prompt)
> > >
> > >
> > >
> > > --
> > > PHP General Mailing List (http://www.php.net/)
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > > To contact the list administrators, e-mail:
[EMAIL PROTECTED]
> > >
> > >
> >
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to