Database Query Output to a variable


I’m trying to create a custom report but I’m having a little problem to understand how can I save the output of this function to a variable:

SELECT count(DISTINCT `quote_number`)
FROM ip_quotes
WHERE quote_id IN (
                    SELECT quote_id
                    FROM ip_quotes
                    WHERE ip_quotes.client_id = ip_clients.client_id
) AS range_total', FALSE);

I want it to give me the number of quotes I have per customer and it does work the problem is that I cannot assign the result value to a regular variable, does any one knows how to do that I need it to be a regular $Total_quotes? Thanks a lot!