In the end a stored procedure was the solution for my problem. Here´s what helped:
DELIMITER //
CREATE PROCEDURE test ()
BEGIN
DECLARE myvar DOUBLE;
SELECT somevalue INTO myvar FROM mytable WHERE uid=1;
SELECT myvar;
END
//
DELIMITER ;
call test ();