Support » Fixing WordPress » Output DB Table into Results Page table

  • corpunderground


    I’ll start by saying I’m new enough to be naive and uncertain how a concept should work. But, I am technical enough that when I could not get phpMyadmin to accept a csv import to SQl, I created my own Ubuntu server, installed XAMPP, installed WP locally (5.9.3), and worked out the kinks between the csv and SQl fields to make it work locally.
    I am currently trying to use Hosted WP via GoDaddy, while using the local install for testing.

    The issues is that I know what I’d like to do, I just don’t know if it’s feasible or how best to do it.
    What I would like to do, is to store custom fields in the SQL database and allow site visitors access to query the “Title” and “Tag” fields via parameterized query from the website front end. I don’t want to have to load all the content by posts; I can categorize it into a sheet and upload tons of data in 1 shot. And the max number of fields is less than 10 currently, so it’s not a heavy lift. The basic functionality should be to search the custom table for a keyword, such as ‘kiwi’, and then outputs to a results page the entries that contain the key word (or %like% ‘keyword’).

    I am not certain if I can do this with native WP tools, if I need a particular widget, or if it can’t be done and I need a different solution. I’d like to stay in WP because of all the other functionality it offers. It might be a scenario where I have a hybrid website. I just don’t have the end vision of how it all ties together.

    Eventually, I would like a REST API to import data from other streams, create new fields based on columns, and allow that to be exportable to external systems. I include that point because it’s part of the broad vision, if I can ever get the first part dealt with.

    If anyone willing to help needs more data, let me know. Being new I’m not sure what all to include, especially because it seems conceptual in nature. And thank you in advance for guidance and a kick in the right direction.

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator bcworkz


    You can do anything you like on the WP database through the global $wpdb object’s methods (class wpdb). You can make completely custom SQL queries for anything in the DB. The results will come back in array form. Your page’s code would loop through the results to output the data in HTML format.

    Probably the most understandable way to implement custom code that does all of this is to create a custom page template for the purpose.

    Thread Starter corpunderground


    Thank you @bcworkz I will dig into this today and report back

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.