Querying custom tables in the wp database and displaying results on a page
-
I’m not a very good with code, but I wanted to ask if the following plan of action is right for my objective, which is for my blog to have a special page that queries a database of, say, about 100 book titles, authors, etc.
Here’s what I think I should do:
1. Create custom tables at the wp database for the book collection.
2. Create a function that queries the database and returns the result as $wpdb which I think is standard
3. Make a new page template by saving index.php as bookfind.php
4. Call the function from somewhere inside bookfind.phpIs that correct? If so, I just wanted to ask a few questions to help nudge me in the right direction.
1. How do I apply bookfind.php as a template so I can call it from the wordpress system?
2. Would it be better to create a widget for this, so I can deploy it anywhere I like?
3. Would creating a widget be easier than making a template?I know little PHP at the moment, as I’m more familiar with MySQL. I’m willing to do the research and grunt work and all that. But I would hate to spend weeks studying geology (so to speak), only to find out that it was geography I should have studied all along, if you get my drift.
Cheers
- The topic ‘Querying custom tables in the wp database and displaying results on a page’ is closed to new replies.