Title: Custom MySQL queries
Last modified: August 30, 2016

---

# Custom MySQL queries

 *  [Ghostflasher](https://wordpress.org/support/users/ghostflasher/)
 * (@ghostflasher)
 * [10 years, 7 months ago](https://wordpress.org/support/topic/custom-mysql-queries/)
 * Hi,
 * is it possible to create my own MySQL query and retrieve the result?
 * [https://wordpress.org/plugins/participants-database/](https://wordpress.org/plugins/participants-database/)

Viewing 5 replies - 1 through 5 (of 5 total)

 *  Plugin Author [xnau webdesign](https://wordpress.org/support/users/xnau/)
 * (@xnau)
 * [10 years, 7 months ago](https://wordpress.org/support/topic/custom-mysql-queries/#post-6592164)
 * It certainly is, if you’re familiar with constructing queries, that’s a good 
   way to go. If you want to use the plugin to show the results, however, you will
   need to use a filter so the query is used by the plugin to generate the results.
 * Take a look at the [plugin API](http://xnau.com/work/wordpress-plugins/participants-database/participants-database-documentation/participants-database-1-6-api/#lq)
   under ‘pdb-list_query’
 *  Thread Starter [Ghostflasher](https://wordpress.org/support/users/ghostflasher/)
 * (@ghostflasher)
 * [10 years, 7 months ago](https://wordpress.org/support/topic/custom-mysql-queries/#post-6592216)
 * Thanks xnau!
 * I found that solution too and was able to finish my multi column search. Next
   on the list is multilanguage support… Let’s get to work 😉
 * Thanks for the great plugin… I just donated a couple of bucks.
 *  Plugin Author [xnau webdesign](https://wordpress.org/support/users/xnau/)
 * (@xnau)
 * [10 years, 7 months ago](https://wordpress.org/support/topic/custom-mysql-queries/#post-6592290)
 * Thank you!
 *  [PowerjobMidt](https://wordpress.org/support/users/powerjobmidt/)
 * (@powerjobmidt)
 * [10 years, 7 months ago](https://wordpress.org/support/topic/custom-mysql-queries/#post-6592334)
 * Hi Ghostflasher,
 * We face the same challenge of searching multiple fields. Will you share your 
   solution with us?
 * Thank you in advance.
 *  Thread Starter [Ghostflasher](https://wordpress.org/support/users/ghostflasher/)
 * (@ghostflasher)
 * [10 years, 7 months ago](https://wordpress.org/support/topic/custom-mysql-queries/#post-6592378)
 * Hi Powerjob,
 * sorry for the late reply. I was a bit in a hurry to complete my work on time.
   
   Ok, It is actually pretty easy, when u know how to do it. First you have create
   your own search form. U have to add brackets to search_field -> search_field[]
   and value -> value[]
 * Use the pdb_search_custom and build there your form. Leave the
    $this->search_sort_form_top();
   active and delete the rest. So u can be sure, that the nonce and the start of
   the form is correct.
 * Then add your fields like that:
 *     ```
       <select name='search_field[]' id='pdb-search_field_select'  class='search-item' style='display:none;'>
                         <ul><option value='columnName' selected >someValue</option></ul>
                 </select>
                               <input type='checkbox' name='value[]' value='someValue'> someValue</input>
       ```
   
 * Be sure to add the search_field selector before every searchfield. That way you
   can submit in what field you want to search with the following searchinput.
 * Don’t forget to add the submit button in the end of the form, that was opened
   by the search_sort_form_top() function. Close the form properly.
 * Now u only have to readout the $_POST in the displaying list file. Read out the
   search_field and the submitted values and hook them up with the [pdb_list filter
   =”*searchterms*”] shortcode.
 * e.g.
    `$filter = "[pdb_list filter='city~london']";`
 * then
 * `echo do_shortcode($filter);’
 * I guess it’s a pretty dirty walkaround but it seems to work and I didn’t had 
   to alter any file from the plugin. So when there are any updates for the plugin
   this should still work.
 * hope u can figure it out.

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Custom MySQL queries’ is closed to new replies.

 * ![](https://ps.w.org/participants-database/assets/icon-256x256.jpg?rev=1389807)
 * [Participants Database](https://wordpress.org/plugins/participants-database/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/participants-database/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/participants-database/)
 * [Active Topics](https://wordpress.org/support/plugin/participants-database/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/participants-database/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/participants-database/reviews/)

 * 5 replies
 * 3 participants
 * Last reply from: [Ghostflasher](https://wordpress.org/support/users/ghostflasher/)
 * Last activity: [10 years, 7 months ago](https://wordpress.org/support/topic/custom-mysql-queries/#post-6592378)
 * Status: not resolved