Can i UpDating a Tag with php?

Hi guys,

i am new to unity 3d
and general in the magic world of 3D Graphics

I want to ask you, if i can update the name of a tag.
The new name of the tag i want to take it from a database … from a …example.php

Thank you very much!!!

If you mean change a tag at runtime: Question.

CODE EDIT: If you are using MySQL, you could do the following: (not testet, just scribbled down in a hurry.) You should then have a MySQL database ‘TagDB’, with a table ‘tags’ and a content of ‘tagid’ and ‘tagname’. Comment below if problems.

TagRequest.js:

    var tagproducer_url = "http://www.my-site.com/tagproducer.php";
    var tagID = 123; //id in the database where the tag is stored
             
    var currenttag;

    function Start() {
        var form = new WWWForm();
        form.AddField( "tagID", tagID);
        var download = new WWW( tagproducer_url, form );

        yield download;

        if(download.error) {
            print( "Error downloading: " + download.error );
            return;
        } else {
            currenttag = download.text; 
        }
    }

public function getTag() {
	return currenttag;
}

tagproducer.php:

if( isset($_POST['tagID'])) {
    header("Content-Type: text/plain");

    $pdo = new PDO('mysql:host=localhost;dbname=tagDB;charset=utf8', 'username', 'password'); //put your mysql login-data in here
    $msql = $pdo->prepare('SELECT * FROM `tags` WHERE id=:tagid'); //where tags is your mysql table
    $tagid = $_POST['tagID'] * 1;
    $msql->bindParam(':tagid', $tagid, PDO::PARAM_INT);
    $msql->execute();

    if ($msql->rowCount() > 0) {
            
        $newtag = $msql->fetch(PDO::FETCH_ASSOC);
        echo $newtag['tagname'];
    } else {
        //report: no tagid found or something.
    }
}

yourCameraScript.js:

GameObject.Find("g_TAG").guiText.text = "no ID";

function Update()
{
    var hit : RaycastHit;
    // if we are colliding with something ..
    if(Physics.Raycast(transform.position, transform.forward, hit, 5))
    {
        // Get the tag from the object we are colliding with
        var ID = hit.collider.gameObject.tag;
        var IDplus = "The ID is "+ID;   
        //check if the object has a tag or is untagged
        if(hit.collider.gameObject.tag ==  "Untagged")  
        {
            //do nothing
            //print("ok");
        } else {
            var tagRequest : TagRequest = hit.collider.gameObject.GetComponent(TagRequest);
            GameObject.Find("g_TAG").guiText.text = tagRequest.getTag();
        }
    }
    else GameObject.Find("g_TAG").guiText.text = "no ID in range";
}