mindstorm8191
New Member
- Messages
- 24
- Reaction score
- 1
- Points
- 3
Hi. I am currently working on a rather large undertaking of a project. I have a script that generates a 20x20 game map, with various fields set in it. However, my SQL query doesn't seem to excecute. Here is a summary of my code:
After reviewing things, I've determined that the generated string is 36658 characters long. It seems this is the reason that the query doesn't run.
So, I imagine that this limit is necessary for a freely hosted site. Could you share what that limit is? I don't have an easy way to determine that from what I can see in the control panel (unless I try a brute-force script to find an answer... probably not wanted). My code has other sections that drop JSON structures into the database, and I'll have to re-think how these are handled. (I'm doing it this way because the objects are fully managed on the client side, not server-side, so this is just a save & load system).
Thanks
PHP:
$built = implode(',', array_map(function($long) {
return implode(',', array_map(function($wide) {
return '('. $wide['x'] .','. $wide['y'] .','. $wide['landType'] .','. rand(0,13) .','. (randfloat()*1.5+0.5) .',-1,0)';
}, $long));
},$fullMap));
$db->query("INSERT INTO sw_map (x, y, biome, ugresource, ugamount, civilization, civlevel) VALUES ". $built .";");
After reviewing things, I've determined that the generated string is 36658 characters long. It seems this is the reason that the query doesn't run.
So, I imagine that this limit is necessary for a freely hosted site. Could you share what that limit is? I don't have an easy way to determine that from what I can see in the control panel (unless I try a brute-force script to find an answer... probably not wanted). My code has other sections that drop JSON structures into the database, and I'll have to re-think how these are handled. (I'm doing it this way because the objects are fully managed on the client side, not server-side, so this is just a save & load system).
Thanks