On Fri, 2002-04-12 at 16:39, Steve Buehler wrote:
> Not a bad Idea.  I guess I will have to hit the php mailing list to find 
> out about this because I tried the following in PHP and it still did the 
> same thing.
> <?
> require("../globals.inc");
> $test=passthru("mysqldump -q -u$userName -p$password -h$hostName 
> $databaseName");
> $test=ereg_replace ("\n", "<br>", $test);
> echo "$test";
> ?>
> 
> I can't seem to get the "passthru" into a variable.  It always displays the 
> results instead.

passthru() returns void!
>From the PHP Manual:

void passthru ( string command [, int return_var])

The passthru() function is similar to the exec() function in that it
executes a command. If the return_var argument is present, the return
status of the Unix command will be placed here


> > > I am using PHP to run the following command:
> > > passthru("mysqldump -q -u$userName -p$password -h$hostName $databaseName");
> > >
> > > The problem is that it puts EVERYTHING on one line and, of course, and
> > > wraps it.  I want to be able to dump the dump(schema) of a database onto a
> > > web page so that they can view and/or cut and paste the dump results.
> > >
> > > An other question.  How can I make the command automatically try to 
> > send it
> > > as a file to the clients computer as an database.sql file so that they can
> > > save it?  Like phpmyadmin does.

You have to do this before sending any output to the client:
header('Content-Type: application/octetstream');
header('Content-Disposition: filename="your_filename"');

-- 
dsoares
(sql)

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to