• Page code

    <!DOCTYPE html>
    <html>
    <body>
    
    <h1>My first PHP page</h1>
    
    <?php
    echo "Hello World!";
    dbTable(“wp_users”)->render(); // call render function on database table, here database table ” tbl ” must be name of your wordpress table
    ?> 
    
    </body>
    </html>
    Page Error
    Payments Edit
    
    My first PHP page
    render(); // call render function on database table, here database table ” tbl ” must be name of your wordpress table
    ?>
Viewing 4 replies - 1 through 4 (of 4 total)
  • Is this in the context of a plugin? I.E. in the /plugins/ folder and as a proper plugin or is this in the context of a theme in wp-content/themes?

    I’m also not familiar with dbTable() – is that provided by some framework you’ve included? Could you provide a bit more background information regarding your question please?

    Thread Starter kensoftwares

    (@kensoftwares)

    yes this is Wp-pdo plugin being used

    Can you please link to the page for this plugin? I can not find a plugin by that name. I found one called “WP DB Driver”, is that it? If so, it’s been outdated for a very long time.

    Moderator bcworkz

    (@bcworkz)

    How are you requesting your page? I’m guessing something like your_domain.com/some/path/filename.php. If so, WordPress is not involved and any WP or plugin functions you might want to call are not available to your page. There are few proper ways to involve WP and have plugin functions be available.

    One way is to make your page file into a WP page template. Save the file in your theme folder, preferably a child theme. Create a new WP page in the WP admin area that is based on your new template. Assign a title, no content required, then publish. Request the page by its permalink and the plugin functions should work.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Cannot connect to Database using Wp PDO’ is closed to new replies.