• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

External database integration

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › General Discussion › External database integration

This topic is: resolved

Tagged: custom, database, external

  • This topic has 2 replies, 1 voice, and was last updated 11 years, 9 months ago by Robodashy.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • May 5, 2014 at 7:20 pm #103781
    Robodashy
    Member

    *NOTE - I've also posted this on the WP forums:
    https://wordpress.org/support/topic/external-database-integration?replies=1
    But figured I'd ask you lovely studiopress forum-goers to see if you can provide any insight to this issue.

    Before I go pastebin'ing a bucketload of code I'll give you the outline of the problem, then if y'all want the code I'll put it in a reply later - but here goes:

    I'm developing a site for a client, pretty much just taking their existing .asp site and converting it to WP (while making it all nice and pretty).
    Almost done, but now I'm stuck.

    The custom search page they have references an external database they have, so what I've done is created a custom page hoping to implement this feature.

    The custom page I've created works, right up until I get to the custom php/sql. If I have the file with just the code above and below the commented stuff that says it works the page renders fine, but no content. It's the stuff between that breaks it (basic code below):
    '
    <?php
    /* BUNCH OF TEMPLATE GENERATING COMMENTS HERE */
    get_header();

    do_action( 'genesis_before_content_sidebar_wrap' );
    genesis_markup( array(
    'html5' => '<div %s>',
    'xhtml' => '<div id="content-sidebar-wrap">',
    'context' => 'content-sidebar-wrap',
    ) );

    do_action( 'genesis_before_content' );
    genesis_markup( array(
    'html5' => '<main %s>',
    'xhtml' => '<div id="content" class="hfeed">',
    'context' => 'content',
    ) );

    ?>
    /* CODE ABOVE WORKS *//* CODE ABOVE WORKS *//* CODE ABOVE WORKS */

    /** This is where the problem lies **/

    /* CODE BELOW WORKS *//* CODE BELOW WORKS *//* CODE BELOW WORKS */
    <?php
    genesis_markup( array(
    'html5' => '</main>', //* end .content
    'xhtml' => '</div>', //* end #content
    ) );
    do_action( 'genesis_after_content' );

    echo '</div>'; //* end .content-sidebar-wrap or #content-sidebar-wrap
    do_action( 'genesis_after_content_sidebar_wrap' );

    get_footer();
    '

    In the /** This is where the problem lies **/ section I have my includes to connect to the external database as well as a formating php file, shouldn't be any problems - then I have all the php/sql connection code that checks the database for ... data ... and then generates html based on the data received.

    With this code included I get the white page of death. Can't even check to see if there are any errors being generated. I've checked for syntax errors but can't find any, so I'm assuming it has something to do with the way WP restricts access to outside sources (or just the way WP restricts stuff in general).

    Can anyone point me in the right direction on how to get this to work?

    Would you like me to paste the full code (pastebin)?
    Or is what I've provided sufficient?

    Should I just have a completely separate php file to run this and just create a custom link to the url?

    Any and all help is most greatly appreciated.

    Thanks.


    The large print giveth, and the small print taketh away.
    – Tom Waits, “Step Right Up”

    May 5, 2014 at 7:57 pm #103782
    Robodashy
    Member

    Ok, so.
    Using the WP database we've created some different tables - turns out I don't need to access a different database, just those tables.

    I'm assuming I use $wpdb and just rename stuff to get the right info?


    The large print giveth, and the small print taketh away.
    – Tom Waits, “Step Right Up”

    May 5, 2014 at 8:19 pm #103783
    Robodashy
    Member

    After some investigation I've discovered I'm asking the wrong question - going to close this one off and create a new topic asking the right thing. Sorry for spam


    The large print giveth, and the small print taketh away.
    – Tom Waits, “Step Right Up”

  • Author
    Posts
Viewing 3 posts - 1 through 3 (of 3 total)
  • The topic ‘External database integration’ is closed to new replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2026 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble