将SELECT @ variable从SQL发送到PHP

I have this statement that's working well in SQL:

SET @cnt = (SELECT `reg_date` FROM logindb WHERE `userlogin`='urs'); 
SET @var = (SELECT TIME (@cnt)); 
SELECT @var

But I don't know how to get that data if I don't have a specific column output.

In php I'm trying with the following code:

$sql = "SET @cnt = (SELECT `reg_date` FROM logindb WHERE `userlogin`='urs'); 
SET @var = (SELECT TIME (@cnt)); 
SELECT @var"
$result = $conn->query($sql);
$row = $result->fetch_assoc();
echo($row["@var"]);

EDIT: Fatal error: Call to a member function fetch_assoc() on boolean in C:\xampp\htdocs\DAN\autentificare.php on line 62

The line 62 :

$row = $result->fetch_assoc();

I don't know how to store or view that variable in PHP. Any help?

Edit: Explanation of the code: When I created the table named logindb, I use a variable reg_date declared as TIMESTAMP that put the server time every time another column from the same line is filled. To resume the entire code is used to get only the TIME from reg_date : Ex. 2015-01-06 00:39:56 output that I get in @var is 00:39:56

Thanks,

Dan

Try this:

SELECT @var as colName
....
echo($row["colName"]);

UPDATE

When I read the pst first time I think that the question is something simplified. Anyway, to solve your issue you can use this code.

$sql = "SELECT TIME(`reg_date`) FROM logindb WHERE `userlogin`='urs'";
$result = $conn->query($sql);
if (!$result)
{
    die('Error in query:' . mysql_error());
}

echo mysql_result($result, 0);

The following code(assuming your $sql statement is valid)

$row = $result->fetch_assoc();

Returns an associative array. To access the value the key would look likethis:

$myresult = $row['column'];

*column is the column you selected in your statement, in your case 'reg_date'