I was thinking that going from and to the maps was slow and about the internal errors and i changed the way the Pokemon appear a bit.
BEFORE:
JavaScript sent data to the PHP code, which "slept" for 5-10 seconds and then a Pokemon appeared.
AFTER:
JavaScript sends data to the PHP which executes immediately(without sleeping). It gets a random number from 1-10. If the number is 1, the Pokemon appears. Else, it just says "Nothing appeared! Keep moving around!". Then, JavaScript "sees" that and sends data to the PHP file again etc etc.
I don't know if this will cause less internal errors. But it will make changes pages from and to the map faster.
Also now when you defeat or catch a Pokemon, the page doesn't refresh. Instead, the JavaScript sends that data again. That means, the map page is actually being requested less. It also means good news for those who have a slow connection (although most browsers cache things [keep temporary data] so refreshing wouldn't take too long



