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.

$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 :)

Application and Templating Framework for PHP

PHP General Mailing List (
To unsubscribe, visit:

Reply via email to