• vbsa

    (@vbsa)


    Hi folks, a quick question as a newbie. I have a MySQL DB (versions below) on my Siteground custom built web site. This contains membership details amongst other data. How can I copy this over to my WordPress Dashboard/website instance also on Siteground? I have installed the same phpMyAdmin plug in on my WordPress site as is installed on my custom website?

    Lastly, is there a plug in that allows me to set up some standard SQL queries to search the database (preferably with no/low code) and setup that query on my WordPress website as a search function e.g. show all members who have scored points.

    DB Server version: 5.7.32-35-log – Source distribution. Protocol version: 10
    Webserver Apache
    Database client version: libmysql – mysqlnd 7.4.25
    PHP extension: mysqli
    PHP version: 7.4.25

    • This topic was modified 3 years ago by Yui. Reason: moved to fixing wordpress
Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator bcworkz

    (@bcworkz)

    You can export/import tables through the phpMyAdmin app. You should avoid having redundant data though. Ideally WP would connect to the member database and query the data directly. Or move the “master” copy to the WP database and abandon the initial source.

    There are a number of advanced search plugins, but they are unlikely to be flexible enough to query tables of unknown schema. The source code would need to be altered to work with your member schema.

    Thread Starter vbsa

    (@vbsa)

    Thanks @bcworkz
    I have copied over the whole database so there is the original WordPress database and our custom database. Thanks for advising me of the limitations of being able to query the database.

    In your view what is the simplest way to achieve this i.e. if we need to learn coding what is the simplest to learn? I have been fault finding on our php but its hardly the most ‘readable‘ straightforward coding language.

    Javascript?
    Python (good at supporting data sets (our DB!)) Also designed to be readable?
    Ruby?

    Moderator bcworkz

    (@bcworkz)

    JavaScript runs client side and the DB is server side, so that won’t help much. Other scripting languages besides PHP are conceptually possible in WP by executing shell commands from PHP. As a practical matter, it’s difficult to accomplish because many web hosts disable the required shell() function out of security concerns. For that reason you’re pretty much stuck with WP’s native language, PHP. Depending on your need, there may not be too much PHP involved, the heavy listing is done through mySQL queries. PHP is used to collect user input, execute mySQL, then output the query results.

    To access any data within the WP database, I recommend using the global instance of the wpdb class, $wpdb. It has a number of methods available to execute various sorts of queries. As a global object, it’s already connected to the DB so you don’t have to mess with that aspect. Its methods operate at a slightly higher level than similar PHP functions. It’s optimized to access WP tables, but it’ll work for any table in the DB.

    There are many ways to integrate into WP. IMO, the easiest for many things is by building a custom page template, which is kept in a child theme. The one template can collect user input, query the DB, and display the results. What is output can be conditional based on whether the request was GET or POST. A GET request displays the input form, which is POSTed in order to see the query results.

    If you’ve experience programming with other languages, you’ll be able to pick up PHP fairly well, despite its obtuse syntax. Not to say it won’t be frustrating at first. What I’d do in your situation is try to find example code that’s close to what you need so you only need to alter it instead of building from scratch. Cobble together the whole from small parts, modifying and filling in as needed to get it all to work as one. Everyone works and learns differently, so a different approach might be more suitable for you.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Copy member DB’ is closed to new replies.