• I would like to have a single-field search box on the front end, where the users can insert in a “name” to see if it is registered under an organisation. Once they enter the name, it will either tell them the “name” is registered ornot.

    Here’s what I need:

    1- On the back end, I need to create a database to house the “name”. The data I need to be stored is the “name” (may be I may add others data).
    Ex. “name”: abc company

    2- On the front end, I need to have a search box with only one field (i.e. input the “name”) to put on a page. After searching, the users can get the info. of such “name”. (the users aren’t WordPress users, so no login is needed to access the search page)

    It seems as if this would be possible with WordPress, but I’m fairly new to WordPress (I prefer it can be done through plugin) so this has been pretty hard to wrap my head around.

    Would I create a whole new database or would I add a custom table in the existing WordPress database? Any plugins out there that I could turn to?

    Thank you very much.

Viewing 3 replies - 1 through 3 (of 3 total)
  • This is certainly possible to do. I have made systems that do this.

    I would add a new table to the WordPress database, this will be completely used by your own code, the rest of WordPress will know nothing about it. This way you can use the same $wpdb variable to access your table as used by the rest of WordPress.

    I found studying this plugin very informative in many ways.
    https://wordpress.org/plugins/wp-csv-to-database/
    Author: Ruhul Amin

    Be sure to use “prepare” to safely incorporate the user input field into your SQL query.

    There are two different ways to incorporate your code into your website:
    – In your theme as custom page templates.
    – Create a plugin, have it register shortcodes that your search page uses to activate your code.

    Moderator bcworkz

    (@bcworkz)

    While I’m inclined to agree with Ross on creating a custom table, for the sake of presenting options, each “name” record could be its own post of a custom post type. Related data could be saved as post meta data that’s maintained through custom fields. The main advantage is you can use more of built-in WP functionality to search and maintain the data. Less custom coding will be needed.

    The disadvantages are that meta queries on very large DBs are not very efficient and initially importing the data would be more complex.

    Thread Starter hohokfong

    (@hohokfong)

    Thank you RossMitchell & bcworkz.

    I learn how to use the plugin first.

    If I come across difficulties, I will ask you again.

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

The topic ‘get own data from one seach’ is closed to new replies.