Prev: [ENCODING QUEUE] - anyone think of a good way to setup aqueuing system so everyone gets their turn
Next: login to protected directory by php
From: Simon J Welsh on 13 Aug 2010 19:53
On 14/08/2010, at 9:59 AM, Ashley Sheridan wrote:
> I've only ever done something like this via the command line. Having
> said that, could you maybe pass a command line string to exec().
> Something like (untested):
> echo 'password' | mysql -u root -p < query
> I believe that is the right sort of thing, but I've never quite done it
> all as a single statement like this before, I've always tended to type
> in things on a line-by-line basis.
That wont work, as pipping just passes stdout to stdin, which mysql grabs queries to run from (which you're using file redirection for).
I know of someone that wanted to do something similar, but didn't want to use a plaintext password in the command (shared host security and that sort of stuff), so they got PHP to generate a defaults file with the user/password and passed that instead (--defaults-extra-file)
Admin of http://simon.geek.nz/
Who said Microsoft never created a bug-free program? The blue screen never, ever crashes!