Thats way out of my league for php programming. I utilize one php file for each type of request. I know it takes up more room and is redundant but its more easy for me to get my head around. What your doing in the capx looks fine though. Heres a copy of one of my php files(work in progress I know I need to add the safety check like stripslashes :)) Anyways heres what works for me:
And the php file:
<?php
$minx = $_REQUEST['min_x'];
$miny = $_REQUEST['min_y'];
$terrain = $_REQUEST['ter'];
$SFood = $_REQUEST['food'];
$SWood = $_REQUEST['wood'];
$SStone = $_REQUEST['stone'];
$SOre = $_REQUEST['ore'];
$SGems = $_REQUEST['gems'];
//Connect To Database
$hostname='#####';
$username='#####;
$password='#####';
$dbname='#####';
$usertable='#####';
$MapID = 'Map_ID';
$MapX = 'Map_X';
$MapY = 'Map_Y';
$MapTYPE = 'Map_TYPE';
$Food = 'Map_FOOD';
$Wood = 'Map_WOOD';
$Stone = 'Map_STONE';
$Ore = 'Map_ORE';
$Gems = 'Map_GEMS';
$con = mysql_connect($hostname,$username,$password);
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db($dbname, $con);
$sql="INSERT INTO $usertable ($MapX, $MapY, $MapTYPE, $Food, $Wood, $Stone, $Ore, $Gems)
VALUES
('$minx','$miny','$terrain','$SFood','$SWood','$SStone','$SOre','$SGems')";
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
echo "1 record added";
mysql_close($con);
?>
Just remember this isn't an effective php script yet. Still need the safety features so feel free to take from it what you want just be warned it's currently not secure enough for commercial use. :)