Good day! I came with my first problem in coding :( here is my php script:
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("
", $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;
This script automatically adds data to sql db. It used to work correctly, but now when i adding stuff via this script it won't show in my site tho.. But it's interesting that when i add the same information in sql db using PhpMyAdmin panel it will appear in my site.. but using this code won't appear.. Please tell me what it is.. i don't get it.. my phpMyAdmin version - 3.5.6