WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Inline PHP and SQL Queries (4 posts)

  1. calebcall
    Member
    Posted 4 years ago #

    I currently have a site that is written in PHP/HTML that I am working on converting to use WordPress. On my main page I have a table that's built dynamically from a database query. I'm trying to do the same thing within WordPress and it doesn't seem to be working. I've got the Inline PHP module installed and I'm wrapping my php tags with <exec> </exec> but my table is not getting built??? All my static content shows up but nothing from the query.

    Is there a better way to build these queries in WordPress (I'm a new WordPress user) then using the Inline PHP? Will my PHP SQL queries work with the Inline PHP plug-in?

  2. esmi
    Forum Moderator
    Posted 4 years ago #

    If your main page is a static Page (as opposed to a page of posts), you could create a custom template that incorporates your database query and table. No need for any plugins.

    http://codex.wordpress.org/Pages#Creating_Your_Own_Page_Templates

  3. calebcall
    Member
    Posted 4 years ago #

    BRILLIANT!!! Something so simple. Thanks!

  4. jeffwithag
    Member
    Posted 4 years ago #

    Slight extension to this issue. I can do my queries via the template approach. Or I can utilize shortcodes via the page approach. But what if I want to utilize shortcodes with the data extracted via the query?

    Query doesn't work in page, shortcodes don't work in template???

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.