I ran a few tests as well and the few system commands I tried only saved the *last* line of the output in a variable on success as the manual suggests it should - better than nothing - but not the entire output as you seem to suggest you were able to do and what I have been trying to do.
"Analysis & Solutions" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > On Wed, Jul 10, 2002 at 12:14:58PM -0700, Fargo Lee wrote: > > > > This suggests, as do a few posts I just noticed in the manual, that > > one cannot assign the output of system() and perhaps passthru() and exec() > > to a variable. > > I forgot to mention, that's not accurate. I just ran a test to make sure. > Got the results just fine. > > Just for clarity, here's my test (PHP 4.2.1, NT 4.0): > > # real directory. > # result: output shows file list, false no, return 0 > # $output = system('dir c:\books', $return_var); > > # fake directory. > # result: output shows nothing, false yes, return 1 > $output = system('dir y:\fake', $return_var); > > echo "output: $output"; > echo '<hr />'; > echo 'output false? ' . ( ($output == FALSE) ? 'yes' : 'no' ); > echo '<hr />'; > echo "return: $return_var"; > > > --Dan > > > I think this is only possible using backticks, which I can't > > use as this needs to be run in safe mode. So I guess I just need to use the > > return_var as you suggested. Thanks! > > > > "Analysis & Solutions" <[EMAIL PROTECTED]> wrote in message > > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > > On Tue, Jul 09, 2002 at 11:41:47PM -0700, Fargo Lee wrote: > > > > > > > got it to assign a 0 (success) or 1 (failure) to the return_var argument > > as > > > > you suggested so I am happy. > > > > > > Good! > > > > > > > > > > What mixed me up and I still don't understand is the manual entry for > > > > system() says ... > > > > > > > > "Returns the last line of the command output on success, and FALSE on > > > > failure." > > > > > > > > When it says it "Returns", where does it return this information and how > > can > > > > it be captured for comparison? > > > > > > The thing that's tripping you up is, I believe, executing MySQL programs > > > at a prompt doesn't produce any visible output. But, if you executed a > > > command that returns some output to STDOUT, like "ls", you'd see the last > > > line of output therefrom in the "Return." > > > > > > --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 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