External database integration

Community Forums Forums General Discussion External database integration

This topic is: resolved

This topic contains 2 replies, has 1 voice, and was last updated by  Robodashy 2 months, 2 weeks ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #103781

    Robodashy
    Member
    Post count: 17

    *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”

    #103782

    Robodashy
    Member
    Post count: 17

    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”

    #103783

    Robodashy
    Member
    Post count: 17

    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”

Viewing 3 posts - 1 through 3 (of 3 total)

The topic ‘External database integration’ is closed to new replies.