Support » Fixing WordPress » Need help using my own PHP/HTML in WordPress

  • I had a fully-functional web site hosted on Blue Host, but decided that I’d rather stick to the programming, not design, so I wiped out my stuff and installed WordPress. My intent is to use WordPress for the themes, comments, and blogging part of this site, if I choose to blog down the road, but I want MY stuff to be selectable from a PAGE.

    I figured the home page would be an introduction to the site, which is a database lookup for several different things pertaining to music by Vince Gill. The next PAGE, currently called SAMPLE is where the PHP is which drives the lookup.

    I copied the source from one of my pages of the site that used to work and pasted it into the text editor in WordPress. It will not process all the code. It displays the code as text. What am I doing wrong?

    Here’s the code:

    [please review how to post code:
    part of the code below got broken by the forum’s parser]

    <?php require_once("connection.php"); ?>
    <?php include("header.php"); ?>
    $result = mysql_query("SELECT * FROM VGVocalists ORDER BY LastName, FirstName",$connection);
       if ($result == false) {
        die("Database query failed: " . mysql_error());
    	echo "<div>";
    	echo "<form action='VGBGVSResults.php' method='post'>";
    	echo  "<p><h3>Display info on all vocalists or choose
    	              one from the drop-down list</h3>";
    	echo  "<select name=selinput>";
    	echo   "<option value=All>All Vocalists</option>";
    	    while ($row = mysql_fetch_array($result)) {
    	      echo "<option value='{$row[Name]}'>{$row[Name]}
    	echo "</select>";
            echo "</p>";
    	echo "<input type='submit'>";
    	echo "</form>";
    	echo "</div>";
    <a href="index.php">Return to main page</a>
    	<?php include("copyright.php"); ?>

    The website is

Viewing 3 replies - 1 through 3 (of 3 total)
  • I don’t know much about the code side of things myself but it looks to me that you are not thinking about WordPress own schema.

    your WordPress install has its own db and a raft of functions and stuff.

    I can only think to suggest that you take a good look at WordPress template hierarchy, the loop and some of the template tags.



    Forum Moderator

    copied the source from one of my pages of the site that used to work and pasted it into the text editor in WordPress

    php code does not work in the content of posts or pages, unless you use a plugin to enable that;

    a different approach would be to create page templates for the purpose of making pages with custom php code;

    Thank you both for the quick responses. I’ve started reading about the templates and it looks like that will work (when I eventually get it all figured out). I appreciate your assistance!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Need help using my own PHP/HTML in WordPress’ is closed to new replies.