[ticket/12366] Changed to sql_build_query

PHPBB3-12366