Question: I am using session\_set\_save\_handler to save session in database instead of file.
when using session\_regenerate\_id() it create the new session id but all the session data get blank and no entry

old session id - ajphtktier8essc3sjdrj26fei

session class write function query

```
REPLACE INTO sessions(id,access,data) VALUES('ajphtktier8essc3sjdrj26fei','1116980724','CSRFP-Token|a:bs:{i:0;s:10:\"6251880c66\";i:1;s:10:\"c6ec0a462b\";}userid|i:7;auserid|s:1:\"0\";')

```

after session\_regenerate\_id()

new sessionid - pinbo270grhbaaaijbntqhl790sgn

session class write function query

```
REPLACE INTO sessions(id,access,data) VALUES('','','')

```

all the values goes blank and my user unable to login.

Session file is handling session\_start(); this file is included in the script

my code after verify login credentials

```
    session_regenerate_id();  
    $_SESSION['userid'] = $row2['id'];
    $_SESSION['auserid'] = "0";
    header('Location: index.php');
    exit();

```

Answer: 
I'm pretty sure you would like your first `if` check wrap the entire thing, not only the first line.

Currently you are every frame firing a Raycast and destroy whatever you hit.

You rather want to only do this **once** per tap like e.g.

```
void Update()
{
    if (Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Began)
    {
        var ray = Camera.main.ScreenPointToRay(Input.GetTouch(0).position);

        if (Physics.Raycast(ray, out var hit)) 
        {
            Debug.Log("hit something");
            Destroy(hit.transform.gameObject);
        }
    }
}

```
It's obvious that your if statement is missing a bracket {},
If your "Destory()" method can't ecstasy a game object, try the "DestroyImmediate()" method. DestroyImmediate will be destroyed as soon as it is destroyed, and the memory will be released. It takes more time to perform this operation and affects the main thread, while Destroy is destroyed asynchronously, which is generally destroyed in the next frame and will not affect the main thread.
[![enter image description here](https://i.stack.imgur.com/ttcz1.png)](https://i.stack.imgur.com/ttcz1.png)