Title: How to embed an SQL database search functionality
Last modified: August 19, 2016

---

# How to embed an SQL database search functionality

 *  [vatodorov](https://wordpress.org/support/users/vatodorov/)
 * (@vatodorov)
 * [15 years, 3 months ago](https://wordpress.org/support/topic/how-to-embed-an-sql-database-search-functionality/)
 * I have an SQL database and would like to provide a functionality for site visitors
   to search by:
 * 1. State (with a drop down menu)
    OR by: 2. Company name (by entering company
   name)
 * Is this possible? Thank you.
 * Valentin

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

 *  [stvwlf](https://wordpress.org/support/users/stvwlf/)
 * (@stvwlf)
 * [15 years, 3 months ago](https://wordpress.org/support/topic/how-to-embed-an-sql-database-search-functionality/#post-1842052)
 * Without more explanation no one can really help you very much. There is nothing
   natively in WordPress that includes State or Company Name. Where is the information
   coming from that you want to be searchable?
 *  Thread Starter [vatodorov](https://wordpress.org/support/users/vatodorov/)
 * (@vatodorov)
 * [15 years, 3 months ago](https://wordpress.org/support/topic/how-to-embed-an-sql-database-search-functionality/#post-1842156)
 * Basically, I want to provide two different types of search functionalities to
   the website. I have an external dataset that is uploaded to a SQL database and
   I want to make it searchable. Upon search, the results should be displayed in
   a formated table on the WordPress website.
 * So, here are the two search functionalities I am trying to add:
    1. I want to
   have a drop down menu similar to the one on the screenshot here: [http://www.vatodorov.com/upload/Misc/Dropdown%20example.JPG](http://www.vatodorov.com/upload/Misc/Dropdown%20example.JPG)
   My database already has a field called State, but I don’t know how to put this
   drop-down on the website 2. I also want to provide a separate search that will
   let visitors search through names in my database. Again, the results of the search
   should appear formatted on the website.
 * I spent a lot of time in the WordPress forums yesterday and it seems like this
   can be achieved using the plugin WP-EXEC with some PHP and SQL coding.
 * Let me know if you have any other ideas.
    Thanks
 *  [stvwlf](https://wordpress.org/support/users/stvwlf/)
 * (@stvwlf)
 * [15 years, 3 months ago](https://wordpress.org/support/topic/how-to-embed-an-sql-database-search-functionality/#post-1842174)
 * Hi
 * What you want to do can be done.
 * I suggest a different approach than using wp-exec. (I just looked at wp-exec 
   website, and that plugin was created for WordPress 1.5, which means it hasn’t
   been updated in about 5 years).
 * The content you want to display exists entirely outside of WordPress. I suggest
   you use a custom page template – see
    [http://codex.wordpress.org/Pages#Creating_Your_Own_Page_Templates](http://codex.wordpress.org/Pages#Creating_Your_Own_Page_Templates)
 * In this case you would not use WordPress posts or pages or custom post types.
   On the custom page template you would write (or have written if you don’t have
   the knowhow to do it yourself) PHP code to extract the info from the database
   and display it on a page.
 * For pages like that you would be using WordPress only as a container within which
   to display the results – they custom page would appear in the site Nav, The page
   of results would use the site’s theme to display so it looks like the rest of
   the site.
 * But the code to display from the database would not use the WordPress loop. It
   would be PHP / MySQL data retrieval and display code.
 * I really doubt you will find a plugin that lets you display results from an external
   database, formatted the way you want them to appear. The reason is every external
   database is different, has different tables and table structures. And no two 
   sites will want the external data visually displayed in the same way. So there
   is little generalization to encapsulate in a plugin as everyone wants it different.
 * I’ve created pages on some sites along the lines of what you want to do thus 
   I know it can be done. But it requires writing custom code.
 *  Thread Starter [vatodorov](https://wordpress.org/support/users/vatodorov/)
 * (@vatodorov)
 * [15 years, 3 months ago](https://wordpress.org/support/topic/how-to-embed-an-sql-database-search-functionality/#post-1842383)
 * Thank you for the thorough explanation. It helps a lot!
 * I have some knowledge of working with WordPress, but don’t know PHP. A friend
   of mine will help me with that.

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

The topic ‘How to embed an SQL database search functionality’ is closed to new replies.

## Tags

 * [database](https://wordpress.org/support/topic-tag/database/)
 * [sql](https://wordpress.org/support/topic-tag/sql/)

 * 4 replies
 * 2 participants
 * Last reply from: [vatodorov](https://wordpress.org/support/users/vatodorov/)
 * Last activity: [15 years, 3 months ago](https://wordpress.org/support/topic/how-to-embed-an-sql-database-search-functionality/#post-1842383)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
