Try using backticks, and you don't need spaces after -u and -p

$result = `MySQL -uuser -ppassword databasename < filename.sql`

Note that if it succeeds, nothing will be returned. Same as when you run
the command on the command line.

---John Holmes...

> -----Original Message-----
> From: Fargo Lee [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, July 10, 2002 1:27 AM
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP] How do I import tables into MySQL from web page ...
> 
> Thanks for pointing out the syntax error. I added the space after the
-u
> but
> it did not make any difference. It still gives the same result, that
is
> "Success", when it actually fails. What I am trying to figure out is
how I
> can tell if it failed (did not create the tables)? The $status
variable
> does
> not appear to hold the output of the system() function. Anyone know
how to
> get the output of system, passthru or exec into the $status variable
to
> check for success or failure?
> 
> "Analysis & Solutions" <[EMAIL PROTECTED]> wrote in
message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > On Tue, Jul 09, 2002 at 06:09:36PM -0700, Fargo Lee wrote:
> > >
> > > $status = system("mysql -umyuserid -pmypassword mydbname <
> >
> > You need a space between "-u" and "myuserid"
> >
> > --Dan
> >
> > --
> >                PHP classes that make web design easier
> >         SQL Solution  |   Layout Solution   |  Form Solution
> >     sqlsolution.info  | layoutsolution.info |  formsolution.info
> >  T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
> >  4015 7 Av #4AJ, Brooklyn NY     v: 718-854-0335     f: 718-854-0409
> 
> 
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php


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

Reply via email to