Greetings everyone,
Since our last host provider seems to have gone under, I am in the process of moving everything to a new host provider. After doing some digging, I really like what Wordpress has to offer but the biggest roadblock is trying to convert all the .html/.php pages into something that Wordpress can execute.
Currently - I installed Wordpress on the host provider which created a WP database. I have installed a new database with the same provider that contains all the tables from the old website. So in the past, I had a db.inc file that contained the username, password and hostname to make the connection and would insert within the .html/.php page. I know that for Wordpress database this information is stored in the wp-config.php in the root directory. Since I am using a different database name, user, pass for the secondary db, then I would need to either add this secondary information to the same file or put in a new file? I don't know if I'm not using the right keywords for searching, but I cannot find any definitive information on what needs to be done. I thought about adding all the tables into the same wp db already created, but would like to keep separate.
I thought maybe it would help to create a WP page template for each of the pages that need to be converted since they would all connect to the same db, just a different table...maybe?
It seems there are plugins that could be used to accept PHP code, but then I wonder about security, making the job harder than it needs to be...where it should be possible to use the built-in $wpdb. I find a lot of snippets of information, but nothing that ties it all together.
As an example, here is the code from one of the .html pages that would query the database and then format the results:
<?php include("../../../../includes/db.inc");
$dbh=@mysql_connect ("$dbhost", "$dbuser", "$dbpass") or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("$dbname");
$qrySurname__letter = "%";
// Output letters as links: (Ascii range from 65 to 90 are letters A to Z!)
// Trying to do this automatically without having to resort to hand coding // of every single link
for($x=65;$x<=90;$x++)
{
if ($x==ord($subsel)) echo "<b>".chr($x)."</b>";
else
echo "<a href=\"index.html?letter=".chr($x)."\">".chr($x)."</a> ";
}
echo "<a href=\"index.html\">Original View</a>";
$letter = $_GET["letter"];
if (isset($letter))
{
$qrySurname = "SELECT * FROM mt_olivet_nw_nj WHERE surname LIKE '$letter%' ORDER BY surname";
} else {
$qrySurname = "SELECT * FROM mt_olivet_nw_nj ORDER BY surname";
}
$result = mysql_query($qrySurname);
$num_rows = mysql_num_rows($result);
echo "<BR>(<em><strong>Total Number of Records in Database</strong></em><strong>:</strong>
<font color=\"#FF0000\"><strong>$num_rows</strong></font>)<br><br>";
echo "<TABLE BORDER=1 cellpadding=5 width=525>";
echo "<tr bgcolor=\"#9999CC\">";
echo "<td width=150><strong><center>Name</strong></td>";
echo "<td width=200><center><strong>Inscription</strong></center></td>";
echo "</tr>";
while ($row = mysql_fetch_array($result))
{
echo "<tr>";
echo "<td width=250><strong>{$row['surname']}</strong>, {$row['given']}<br><em>Date of Birth</em>: {$row['dob']}<br><em>Date of Death</em>: {$row['dod']}</td>";
echo "<td width=275><center><em>Inscription</em>: {$row['inscrip']}<br><em>Photo#</em>: <a href=\"JavaScript:newWindow('images/{$row['photo_ID']}.jpg','popup',420,320,'')\">{$row['photo_ID']}</a></center></td>";
echo "</tr>";
}
echo "</TABLE>";
So to simplify the question:
1) Need to modify/create file that will allow connection to secondary db within WP
2) Need to create a page in WP and modify the above code that would return formatted results.
Any thoughts, suggestions, or pointers to a good "How To" (that provides directions from start to finish) would be fantastic.
Thank you all for your time and consideration.