How to get information from a database (5 posts)

  1. hjeko
    Posted 4 years ago #


    I really like WordPress and I would like to use it on my next project.

    Here it is:

    - We want to have a site with first page a search
    - Second page is the list of results from the search
    - Third page is the page for a specific database entry that is hosted on a different mysql db (more than 500,000 entries)
    - Fourth page is an error page

    I am not sure how to set that up through wordpress. I am scared to put all db entries on the wordpress install. That's why it's in a different DB.

    Any thoughts on how to make that work and make it SEO friendly?



  2. jonradio
    Posted 4 years ago #

    To access a database other than the WordPress database, you simply grant your WordPress Database ID SELECT access to your other database. Then you code your query like this in PHP:

    global $wpdb;
    $memberlist = $wpdb->get_results('SELECT * FROM people WHERE member ORDER BY namelast');

    That last line is essential or WordPress will fail almost immediately after.

  3. hjeko
    Posted 4 years ago #

    Hello jonradio,

    Thanks for your reply.

    Ok so after granting access to the other database, how do I set up search to this other database? What about getting access to results?

    and when I access an entry, how can I customize the entry?

    I am still new to this and I want to make sure this is simple and efficient.

    Thanks for your help!


  4. jonradio
    Posted 4 years ago #

    Probably best to start reading here:

  5. hjeko
    Posted 4 years ago #

    Thanks a lot :)

Topic Closed

This topic has been closed to new replies.

About this Topic