www php send data to mysql


i managed to retrieve my data from mysql via php but i can't figure out how to send data to mysql via php. I have the php file and thats working when i test it in the browser. When i do this in unity i see that my values don't get posted to the php url. My output is showing :

UPDATE unity SET color = '' WHERE firstname = '' AND lastname = ''

the values are missing.

My script :

function setColor (fname : String, lname : String, newColor : String)
    var form = new WWWForm();
    form.AddField("firstname", fname);
    form.AddField("lastname", lname);
    form.AddField("color", newColor);
    var setData = new WWW(writeColorURL, form);
    yield setData;
        Debug.Log("Data has been sent to mysql");

What am i doing wrong ? Thanks.

ok, i found my problem. it was the url that needed to be constructed in the right format. this was my solution : var createURL = writeColorURL + "?firstname=" + fname + "&lastname=" + lname + "&color=" + newColor; according the php syntax

As a little optimization advice.

unity+php+mysql is unsafe architecture for storing data - header (get or post) can be easily intersepted by cheaters.

Instead of using php scripts I suggest you download .net mysql connector (http://www.mysql.com/downloads/connector/net/) and use C# scripts to communicate with you database.