Quantcast
Viewing all articles
Browse latest Browse all 5530

chrismillard on "Getting data from custom MySQL table"

On the same website where I host my Wordpress site, I have a separate custom MySQL database that has some race results. I have a PHP page that runs a query on the MySQL database, and returns the results as a table. It all works fine.

What I would LIKE to do is incorporate this into my Wordpress site so that the PHP form and resulting table have the same theme settings as my site.

I have taken a copy of my themes PAGE.PHP file and renamed it to TESTPAGE.PHP - I have added the Template name to it (My Test Template). I have also added all of the PHP script from my working file.

I have created a new page within Wordpress, and from the templates dropdown, I have chose My Test Template.

Now, when I load the page, my form appears as expected. I enter the search criteria and press the submit button.

When the page reloads (with the parsed parameters) I can see that my MySQL query looks ok because I am echoing it to the page, but the query doesn't return any results. As I mentioned above, this all works as a standalone PHP file, so I wonder if there is something else that is stopping the query from running?


Viewing all articles
Browse latest Browse all 5530

Trending Articles