• Hello.

    My questions are:

    • 1) How do I approach creating relational database tables and maintain their relationships throughout the web app?
    • 2) Where in the documentation should I look for more information?

    The simplified database schema.

    I want to be able to manage the Image Categories, Images, Image Comments and the Canned Comments in the backend.

    Again, the questions I have are:

    • 1) How do I approach creating relational database tables and maintain their relationships?
    • 2) Where in the documentation should I look for more information?

    I am more than happy to clarify the question if there is any need to.

    Thanks a lot gang.

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

    (@bcworkz)

    You will develop a plugin to interface with WP. You will access the database using $wpdb methods. You could either create the tables manually with myPhpAdmin if this is a one off app, or via the plugin activation hook.

    The relationships are defined by how you construct the SQL queries. You will want to develop a series of functions that add an abstraction layer between procedural code and the database. Functions like list_image_comments() and such to establish relationships and to avoid writing mySQL queries every time you want something out of the database, just as WP does with it’s data. This is best done by defining class properties and methods, but not a requirement.

    If you are looking for examples, you don’t need to look much farther than the WP source code itself.

    Thread Starter SergeBenard

    (@sergebenard)

    This sounds exactly like what I needed to hear. I was having a difficult time wrapping my head around this issue.

    To confirm that I have it understood, can you answer this for me please:

    To make my app work, I’d be building the app as if it were stand-alone, but using the WordPress API and WP’s coding best practices?

    For example:

    // Store table name in variable before creating it
    $table_name = $wpdb->prefix . "cannedcomments";

    Moderator bcworkz

    (@bcworkz)

    Generally, yes that is what I’m thinking. Of course, there will be departures. How they are handled is a judgment call, do your best. For example, in your example code snippet, you might choose to not use table prefixes for some reason. If you have a valid reason, no problem. Without a logical reason, then yes, following WP best practice is a good idea.

    Thread Starter SergeBenard

    (@sergebenard)

    Thank you very much, this is great. Thanks for your time!!

    I sooooo need help and happy to pay. I need a relational database that has a “key” of “customer number” that relates the database of information similar to that Serge described… Anyone interested in doing consulting? Is that allowed to ask on this forum? You can find me everywhere on the web if you search provisional patent video course

    Thanks a million!

    THEN.. what I want to do is to be able to POPULATE this database with an embedded system that can only use HTML using a TCPIP stack using a wireless modem… Crazy right!!??

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Coding Issue – Relational Databases’ is closed to new replies.