Re: php/mysql Query Question.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





admin@xxxxxxxxxxxxxxxxxxx wrote:
I tend to do this robert,
while looking at your example i thought to myself since i am trying to mimick a shell command why not run one.

Result:
<?
$db   = 'db';
$host = 'host';
$user = 'user';
$pass = 'pass';
$query = "select * from $db.my_table";
$ddvery = shell_exec("mysql -u$user -p$pass --html --execute=$query");
echo "<pre>$ddvery</pre>";
?>

Not are the results safe but the unlimited possibilites are amazing. Thanks so much for the kick starter

This presumes your information is all safe and that there are no special shell characters in any of the configuration settings (now and in the future). Also, the shell_exec() function is "identical" to the backtick operator that I used in my example (see the help). You've essentially done what I did, but made it less robust... except for the use of the --execute parameter which I wasn't aware existed since it's just as easy to pipe :)

Cheers,
Rob.
--
http://www.interjinn.com
Application and Templating Framework for PHP

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux