Of course you can access PHP variables for creating the query - as the #__ prefix suggests, you're already running your query from "inside Joomla". Which means it is in php, and something like this should do what you want:
$user =& JFactory::getUser();
$db =& JFactory::getDBO();
if (!$user->guest) {
    $query = 'SELECT leadname, businessname, postcode, gasoiluser, '.
        ' dervuser, kerouser, cf_uid, cf_id '.
        ' FROM #__chronoforms_data_addupdatelead '.
        ' WHERE createdby = '.$db->Quote($user->name)).
        ' ORDER BY cf_created DESC';
    $db->setQuery($query);
}
But a little more context would help us see what you'll have to do exactly - what's the code around the SQL query - is it in a php file?
Remember, echo prints to the Response, which is not what you want to do in this case, you want to change the query; so just concatenate the variable content to your query, as shown above; and you should actually be already be in php mode where this query is defined, so the <?php tag is of no use (but again, too few context to be sure about this)!