Sql通过PHP脚本写入数据,但不显示结果

时间:2014-03-16 15:12:12

标签: php mysql sql phpmyadmin

美好的一天!我带来了编码中的第一个问题:( 这是我的PHP脚本:

case'reload-mobs':
$slctmob=$_POST['slctmob'];
$howmanymobs=$_POST['howmanymobs'];
if(!$slctmob){echo"No mobs were selected!...<br/>";echo"<a href=\"$cp?pg=mob-control&action=reload\">OK</a><br/>";exit;}
if($howmanymobs==0){echo"Please select how many!...<br/>";echo"<a href=\"$cp?pg=mob-control&action=reload\">OK</a><br/>";exit;}
if($howmanymobs>100){echo"Cannot select more than 100!...<br/>";echo"<a href=\"$cp?pg=mob-control&action=reload\">OK</a><br/>";exit;}   
$gj11 = file_get_contents("core/mob/$slctmob");
$mob = explode("\n", $gj11);
if($mob[11]==$slctmob){
    echo"Mob <b>$mob[11]</b> founded...<br/>";
    echo"Mob reloading in <b>$mob[9]</b> started...<br/>";
        #1 - Deleting all old mobs...
        mysql_query("DELETE FROM loc WHERE type='mob' AND loc='$mob[9]'")or die(mysql_error());
        echo"Deleted all old <b>$mob[11]</b> mobs...<br/>";
        #2 - Writing all new mobs...
        foreach (range(1, $howmanymobs) as $rs) {
            $mobname=$slctmob.'.'.$rs;
            mysql_query("INSERT INTO loc SET nick='$mobname', loc='$mob[9]', hp='$mob[2]', type='mob'")or die(mysql_error());
            echo"Added <b>$mobname</b> to <b>$mob[9]</b>..<br/>";
        }
        echo"Mobs refresh ended...<br/>";

    echo"<a href=\"$cp?pg=mob-control&action=reload\">OK</a><br/>";
}else{
    echo"Mob <b>$slctmob</b> not founded in database! Check <b>MOBS.list</b> file if name is correct and try again!...<br/>";
    echo"<a href=\"$cp?pg=mob-control&action=reload\">OK</a><br/>";
    exit;
}
    break;

此脚本自动将数据添加到sql db。它曾经正常工作,但现在当我通过这个脚本添加东西它不会在我的网站上显示...但有趣的是,当我使用PhpMyAdmin面板在sql db中添加相同的信息时,它将出现在我的网站中..但使用此代码将不会出现..请告诉我它是什么..我不明白..我的phpMyAdmin版本 - 3.5.6

0 个答案:

没有答案