How do I create a complete organisation's database, where I can access tables and perform custom SQL requests. I can use PHP and mySQL, I am actually working on a WordPress theme. And I am trying to do something like this:

+----------+     +------------+     +------------+
| Book     |     | Borrow     |     | Reader     |
|----------|     |------------|     |------------|
|codeBook# |_____|codeBook#   |     |codeReader# |
|title     |     |codeReader# |_____|name        |
|datepub   |     |date        |     |age         |
+----------+     +------------+     |contacts    |

Some explanation and link will be great


You can do that accessing the phpmyadmin dashboard of your host, but that is no the right way to do it, i recommend you to research and learn about:

  • Thanks @David for the hints, I have posted an answer, because it was too big for a comment
    – Ninda
    Feb 21 '17 at 15:24

I found a solution:

  • I have already created custom post type for different needs(eg. Book and Reader).
  • I will manually create the remaining tables(eg. Borrow) in phpMyAdmin
  • Then use comment $wpdb->get_results( 'SELECT....'); for custom query
  • It's better to use built-in functionality. In this case, set up Borrow as a custom taxonomy. Then you're not adding non-WP tables and running custom queries.
    – WebElaine
    Feb 21 '17 at 20:24

Not the answer you're looking for? Browse other questions tagged or ask your own question.