diff --git a/admin/checkfields.php b/admin/checkfields.php
index 48ade700748..73c2d114c71 100644
--- a/admin/checkfields.php
+++ b/admin/checkfields.php
@@ -1,6 +1,11 @@
Checking $databasename to ensure all tables exist
\n";
-include("config.php");
+$result = mysql_list_tables($databasename);
+while ($row = mysql_fetch_row($result))
+ {
+ $tablelist[]=$row[0];
+ }
+foreach ($alltables as $at)
+ {
+ echo "--== Checking $at ==--
";
+ if (!in_array($at, $tablelist))
+ {
+ echo "$at table does not exist!
\n";
+ //Create table
+ $ctquery="CREATE TABLE `$at` (\n";
+ foreach ($allfields as $af)
+ {
+ if ($af[0] == $at)
+ {
+ $ctquery .= $af[2]."\n";
+ }
+ }
+ $ctquery .= ")\n";
+ $ctquery .= "TYPE=MyISAM";
+ $ctresult=mysql_query($ctquery) or die ("Couldn't create $at table
$ctquery
".mysql_error);
+ echo "Table Created!";
+ }
+ echo "
\n";
+ }
+echo "
\n";
-echo "$setfontChecking $databasename to ensure all fields exist\n";
+echo "$setfontChecking $databasename to ensure all fields exist\n";
//GET LIST OF TABLES
$tables = mysql_list_tables($databasename);