Re: mysqli sql question

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

 



On 31.08.2011 11:23, Peet Grobler wrote:
Is it possible to get the actual sql that is being used to query or
update the database?>
E.g
$sth = $dbh->prepare ("update table set field=?, field2=? where id=?);
mysqli_bind_param ($sth, 'ssi', 'text1', 'text2', 10);
$sth->execute();

Something like $sth->sql? Or $dbh->sql?
Thanks in advance,
Peet

Hi Peet,

not sure if there is a method to echo the sql but you can set your development MySQL server to log all queries to a log file. Use the log file with tail and you'll get a live view of all queries the server attempts to process.

Open my.cnf / my.ini and add the following line:
log= "/path/to/log/mysqld_query.log"
or
log="D:\logs\mysqld_query.log"

More info here: http://dev.mysql.com/doc/refman/5.1/en/query-log.html

I hope this helps ... ohh and don't forget to clear the log every now and then because it will get HUGE quickly.
--
John



--
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