Retrieving data from mySQL using C#

Hi I am trying to convert a javascript example I found into a C# script but C# seems to be missing the deffnition for Addfield

Can anyone help me please

This is the javascript:

function Start() {
	show_highscore();
}

function submit_highscore(player_name,player_score) {
	var form = new WWWForm();
	form.AddField("action","submit_highscore");
	form.AddField("name",player_name);
	form.AddField("score",player_score);
	var url = "http://localhost/unity/highScores.php";
	var w = WWW(url,form);
	yield w;
}

function show_highscore() {
	var form = new WWWForm();
	form.AddField("action","show_highscore");
	var url = "http://localhost/unity/highScores.php";
	var w = WWW(url,form);
	yield w;
	received_data = Regex.Split(w.data,"</next>");
	scores = (received_data.Length-1)/3;
	for(var i = 0; i<scores;i++) {
		print("Name: " + received_data[2*i] + " Score: " + received_data[2*i+1]);
	}
}

This is what I have in c# so far

using UnityEngine;
using System.Collections;

public class mysqlConnection : MonoBehaviour {
    public string url = "http://localhost/unity/highScores.php";
	
	 IEnumerator Start() {
		WWW www = new WWW(url);
		www.AddField("action","show_highscore");
        yield return www;
		
        if (www.error == null) {
        	Debug.Log("Loaded following XML " + www.text);
        }
    }	
}

but I get the error:

Assets/Networking/mysqlConnection.cs(10,21): error CS1061: Type UnityEngine.WWW' does not contain a definition for AddField’ and no extension method AddField' of type UnityEngine.WWW’ could be found (are you missing a using directive or an assembly reference?)

here is the server side code:

<?php
	mysql_connect("host","user","pass");
	mysql_select_db("test");
	if($_REQUEST['action']=="show_highscore") {
		$query = "SELECT * FROM `highscores` ORDER BY `score` DESC";
		$result = mysql_query($query);
		while($array = mysql_fetch_array($result)) {
			echo $array['player']."</next>";
			echo $array['score']."</next>";
		}
	}
	
	if($_REQUEST['action']=="submit_highscore") {
		$player = $_REQUEST['player'];
		$score = $_REQUEST['score'];
		$query = "INSERT INTO `highscores` ( `player`,`score`) VALUES ('$player','$score')";
		mysql_query($query);
	}
?>

am I simply missing a using directive or does C# not support Addfield?

You are using WWW in your C#, and a WWWForm in javascript. A WWWForm are more of less used to create form data you send with the WWW object.

Thanks, I havent tried it yet but I see what you mean

 IEnumerator Start() {

       WWWForm form = new WWWForm();
       form.AddField("insert", "insert")
       
       WWW www = new WWW(url, form);

        yield return www;


        if (www.error == null) {

            Debug.Log("Loaded following XML " + www.text);

        }

    }