Get one value from query without using foreach
===

I need to perform multiple queries on a database table, basically my PHP script has to:

 1. insert into the table a new user storing his id, name, email;
 2. get the id of the newly created user using his email;
 3. associate the id with a key and a timestamp.

I am pretty new to PDO and my problem is I can't figure out a smart way to get that one `id` without using a `foreach`, so basically my code is:

    $query = "INSERT INTO users(name, surname, email) VALUES('" . $name . "', '" . $surname . "', '" . $email . "')";
    $this->dbconn->query($query);
    					 
    $query = "SELECT id FROM users WHERE email='" . $email . "'";
    $data = $this->dbconn->query($query);
    $id = $data['id'];