Wednesday, August 31, 2011

How to find Query Source in MySQL general Log

Most of the time similar queries are used in different modules of the code-base. At times it gets difficult to find out the page where buggy or slow query is being executed. MySQL provides the option of logging slow and general queries in files. In order to record the source of the executed query it is best that you append a string in query which is then being executed via mysql_query() function of PHP.

$sql = "-- Executed via yourfilename.php:
SELECT * from table;"
;
$resulr = mysql_query($sql,$connection);



By doing this you can now find out where your query got executed. Easy and handy, No? :-)

Sunday, August 28, 2011

Revival

I remember how I started out this blog as a technical blog but later moved my technical rants to http://weblogs.com.pk/kadnan (which is dead now)

For past few weeks I had been thinking to start sharing my technical experience I encounter every day at workplace or at home while working on my personal projects or client based projects. For last two years I am not so active in blogging stuff. Specially after getting married and having a son, it got quite difficult to cope up with many things. Change of priorities made me to abandon many things which were kind of part of my life in past.

I have not quit habit of sharing, thus I use micro blogging tools now for this purpose like Twitter,G+ etc but I think there are still such things which needs to say more. This blog, I am re-opening with the intention that I would share all or most of my technical encounters I face every day.

Stay tuned