This topic is locked

capture the mySQL query string from Advanced Search

8/25/2007 11:50:18 AM
PHPRunner General questions
P
phpwalker author

I would like to capture the mySQL query string when a user sets paramaters in the Advanced Search form.
I want to send this query to another PHP script that will generate mailing labels of unique households...
ex. I have a list view of voters that has customer firstname, lastname, address, sex, dob, party, etc
Users can go to the advanced search form, and select only democrats for example.... Then the "where" part of this query will be used in the following query:
'SELECT DISTINCT `voters`.`LastName`, `voters`.`address`,

FROM voters

WHERE (`voters`.`Party` = "D") <---- This where clause will be dependent on parameters selecte in the advanced search

ORDER BY `voters`.`LastName`
(the key here is using DISTINCT so that I don't generate more than one label per household)
so i'd like to capture the query generated from the Advanced Search form, and send that to my php page (using POST i guess), that will then write the second mySQL query for unique households meeting the search criteria...
as a side note, i am using FPDF to generate a PDF file for the mailing labels
any help would be greatly appreciated,
karen

Sergey Kornilov 8/25/2007

Set $dDebug variable to true in include/dbcommon.php which will print all SQL queries on the Web page.

P
phpwalker author 6/26/2009

Set $dDebug variable to true in include/dbcommon.php which will print all SQL queries on the Web page.


Is there a way to capture this in a variable instead? I don't want the query to dislay on the web page. I am looking to "send" the mySQL query to another script that i am writing.

J
Jane 6/30/2009

Hi,
edit db_query function in the generated inlcude/dbconnection.php file.