Update mySQL at game runtime ???

I have been using the log in tutorial on the Unity forum and the phphandler scripts up till now with no issues. But I seem to be stuck when it comes to updating the database at run time. I'm pretty sure its my PHP command. See Below:

//////////////////////////////////////////////////////////////////////////////////

$SQL = "SELECT * FROM players WHERE gameName = ' " . $gameName . " ' AND playerPassword = ' " . $playerPassword . " ';";

    mysql_query( $SQL ) or die( mysql_error() );

$query = "UPDATE players SET 
strength = ' " . $strength . " ',' " strengthMax = ' " . $strengthMax . " ',' " 
agility = ' " . $agility . " ',' "  agilityMax = ' " . $agilityMax . " ',' "
dexterity = ' " . $dexterity . " ',' " dexterityMax = ' " . $dexterityMax . " ',' "
stamina = ' " . $stamina . " ',' " staminaMax = ' " . $staminaMax . " ',' " 
health = ' " . $health . " ',' " healthMax = ' " . $healthMax . " ',' " 
intelligence = ' " . $intelligence . " ',' " intelligenceMax = ' " . $intelligenceMax . " ',' " 
comprehension = ' " . $comprehension . " ',' " comprehensionMax = ' " . $comprehensionMax . " ',' " 
psyche = ' " . $psyche . " ',' "    psycheMax = ' " . $psycheMax . " ',' " 
mana = ' " . $mana . " ',' " manaMax = ' " . $manaMax . " ',' " 
lastPosX = ' " . $lastPosX . " ',' " lastPosY = ' " . $lastPosY . " ',' " 
lastPosZ = ' " . $lastPosZ . " ',' " anchorHead = ' " . $anchorHead . " ',' " 
anchorLeftHand = ' " . $anchorLeftHand . " ',' " anchorRightHand = ' " . $anchorRightHand . " ',' " 
anchorChest = ' " . $anchorChest . " ',' " anchorPelvis = ' " . $anchorPelvis . " ',' " 
anchorRightBicep = ' " . $anchorRightBicep . " ',' " anchorRightForeArm = ' " . $anchorRightForeArm . " ',' " 
anchorRightWrist = ' " . $anchorRightWrist . " ',' " anchorLeftBicep = ' " . $anchorLeftBicep . " ',' " 
anchorLeftForeArm = ' " . $anchorLeftForeArm . " ',' "  anchorLeftWrist = ' " . $anchorLeftWrist . " ',' " 
anchorRightThigh = ' " . $anchorRightThigh . " ',' " anchorRightCalf = ' " . $anchorRightCalf . " ',' " 
anchorRightAnkle = ' " . $anchorRightAnkle . " ',' " anchorLeftThigh = ' " . $anchorLeftThigh . " ',' " 
anchorLeftCalf = ' " . $anchorLeftCalf . " ',' " anchorLeftAnkle = ' " . $anchorLeftAnkle . " ',' " 
defaultHair = ' " . $defaultHair . " ',' " XPstrength = ' " . $XPstrength . " ',' " 
XPagility = ' " . $XPagility . " ',' " XPdexterity = ' " . $XPdexterity . " ',' " 
XPstamina = ' " . $XPstamina . " ',' " XPhealth = ' " . $XPhealth . " ',' "  
XPintelligence = ' " . $XPintelligence . " ',' " XPcomprehension = ' " . $XPcomprehension . " ',' " 
XPpsyche = ' " . $XPpsyche . " ',' " XPmana = ' " . $XPmana . " ',' " 
hitPoints = ' " . $hitPoints . " ',' " hitPointsMax = ' " . $hitPointsMax . " ',' " 
basePhyAtk = ' " . $basePhyAtk . " ',' " basePhyDef = ' " . $basePhyDef . " ',' "
baseShotAtk = ' " . $baseShotAtk . " ',' " baseMenAtk = ' " . $baseMenAtk . " ',' " 
baseMenDef = ' " . $baseMenDef . " ',' "    speedMod = ' " . $speedMod . " '
WHERE gameName = ' " . $gameName . " ' AND  playerPassword = ' " . $playerPassword . " ';";

///////////////////////////////////////////////////////////////////////////////

I can't seem to find the Syntax Error. Are ther any tutorials show mySQL updating at runtime for Unity??

Thanxs Christian

You are trading off your quotations too often. It should follow a pattern like this:

$query ="UPDATE players SET strength = ' " . $strength . " ', strengthMax = '" . $strengthMax . 
(//)
speedMod = ' " . $speedMod . " ' "  WHERE " gameName = ' " . $gameName . " ' AND  playerPassword = ' " . $playerPassword . " '; " ;

In short, you ended up trying to assign the SQL column $strengthMax to a php variable "strength" (backwards from what it should be) in your sql command...if you fix all that syntax it should work appropriately. If you write your php in a program like Notepad++ or Dreamweaver, it should be much easier to see where your syntax errors are.

If ur doing this make sure to clean the $varibles to prevent SQLInjections