hjælp kan ikke fixe fejl i php
hej er ved at lave en automastik database opdatere for http://www.getmangos.com som skal kunne uploade mysql filer til en database men for nogle fejl og den vil ikke vise mine tabeller og ved ikke hvordan jeg fixer det her kan i se min kode:min fejl er i line 25 og så er der mistanke om fejl i line 7,10,40,58,59,60,66,67 håber i kan finde ud af hvad der er galt
Kode:
du kan også se koden på github.com hvis du gerne vil se linje nummer:
https://github.com/kris914g/Mangos-Mysql-auto-updater-/blob/master/index.php
<?php
echo "Mangos AutoUpdate<hr>";
if ($handle = opendir('./updates'))
/***********************************************************************************************************/
/******************************************Database info****************************************************/
$server = "localhost";
$username = "root";
$password = "password";
$worlddb = "mangosd"; //world database
$realmdb = "realmd"; //realm database
$charactersdb = "characters" // characters database
/***********************************************************************************************************/
/******Do not make changes if you dont know what are you doing**********************************************/
echo "<table border=\"1\">
<tr>
<td>#</td>
<td>Revision</td>
<td>#</td>
<td>Database</td>
<td>DB table</td>
<td>Status</td>
</tr>";
$i = 0;
while (false !== ($file = readdir($handle))) {
if($file == "." || $file == ".."){}else{
$i++;
$exp = explode("_", $file, 4);
$commit_version = str_replace(".sql", "", $exp{[0]);
$updatenum = str_replace(".sql", "", $exp[1]);
if(!is_numeric($updatenum)){
$dbname = str_replace(".sql", "", $exp[1]);
$tablename = str_replace(".sql", "", $exp[2]);
$try = str_replace(".sql", "", $exp[3]);
$updatenum = "#";
}else{
$dbname = str_replace(".sql", "", $exp[2]);
$tablename = str_replace(".sql", "", $exp[3]);
$try = str_replace(".sql", "", $exp[4]);
}
if($try != ""){
$tabelname = $tablename."_".$try;
}
if($dbname == "mangos"){$dbname1 = $worlddb;}
if($dbname == "realmd"){$dbname1 = $realmd
if($dbname == "characters"){$dbname1 = $charactersdb;}
if($dbname != ""{
mysql_connect($server, $username, $password;
mysql_select_db($dbname1);
}
if($tablename != ""){
$table = "INTO TABLE $tablename";
}else{
$table = "";
$table = "#";
}
echo "
<tr>
<td>$i</td>
<td>$commit_version</td>
<td>$updatenum</td>
<td>$dbname1</td>
<td>$tablename</td>";
if($tablename != "#"){
if(mysql_query("LOAD DATA LOCAL INFILE ',/updates/$file' $table")){
copy(".updates/$file", ".succeed/$file");
$status = "<span style=\"color: green;\">Succeed.</span>";
unlink("./updates/$file");
}else{
$status = "<span style=\"color: red;\">Failed</span>: ".mysql_error()."";
}
}else{
copy("./updates/$file", "TryManually/$file");
$status = "<span style=\"color: orange;\">skiped</span>: try to update them Manually.</span>";
unlink("./updates/$file");
}
echo" <td>$status</td>
</td>";
mysql_close();
}
}
echo "</table>";
closedir($handle);
}