Okay, I saw the last post and there’s only one problem. I’ve searched the internet but I can’t find out how to run a command-line script in php. For example: string exec(“GRANT ALL PRIVILEGES ON testdb
. * TO ‘account’@‘localhost’;”). So, I really don’t know how to use the script. How can I use the script correctly?
its just a function executing command and returning string , you can just
exec(something) and echo it or something to see response , look at this
[php]
returned
Pinging phphelp.com [97.74.192.145] with 32 bytes of data: Reply from 97.74.192.145: bytes=32 time=219ms TTL=46 Request timed out. Reply from 97.74.192.145: bytes=32 time=219ms TTL=46 Request timed out. Ping statistics for 97.74.192.145: Packets: Sent = 4, Received = 2, Lost = 2 (50% loss), Approximate round trip times in milli-seconds: Minimum = 219ms, Maximum = 219ms, Average = 219ms Minimum = 219ms, Maximum = 219ms, Average = 219ms
[php]<?php
echo exec(“ping phphelp.com”);
?>[/php]
Minimum = 222ms, Maximum = 222ms, Average = 222ms
First of all sorry about my English,
You are using mysql command at the system shell.
You mus use mysql.
mysql_connect(‘localhost’,$user,$pass)
mysql_query("GRANT ALL PRIVILEGES ON testdb
. * TO ‘account’@‘localhost’);
Or use system shell :
exec(“mysql -u $user -p $pass -e GRANT ALL PRIVILEGES ON testdb
. * TO ‘account’@‘localhost’”);
i’m not sure the syntax of the sentence of shell.
Mysql commands is easier use;