Help Needed With SQL Query (IF Statement)

SELECT
t3. NAME,
t1.standard_quartile,
COUNT(t1.film_id) AS count
FROM
(
SELECT
t1.film_id,
t1.title,

	IF (
		t1.rental_duration / t2.total_duration < 0.25,
		1,

	IF (
		t1.rental_duration / t2.total_duration < 0.5,
		2,

	IF (
		t1.rental_duration / t2.total_duration < 0.75,
		3,
		4
	)
	)
	) AS standard_quartile
	FROM
		film AS t1
	JOIN (
		SELECT
			MAX(rental_duration) AS total_duration
		FROM
			Film
	) AS t2 ON TRUE
) AS t1

JOIN film_category t3 ON t3.film_id = t1.film_id
JOIN category t4 ON t4.category_id = t3.category_id
GROUP BY
t4.category_id,
t1.standard_quart

It gives me this error message

function if(boolean, integer, integer) does not exist

You should use a case expression rather than an IF construct in this context. It would be like this:

	CASE 
		WHEN t1.rental_duration / t2.total_duration < 0.25 THEN 1
		WHEN t1.rental_duration / t2.total_duration < 0.50 THEN 2
		WHEN t1.rental_duration / t2.total_duration < 0.75 THEN 2
		ELSE 4
	END AS standard_quartile

One other thing I would do to keep the code crash-proof is to check if the denominator is zero. That can be done like this:
WHEN t1.rental_duration / NULLIF(t2.total_duration,0) < 0.25 THEN 1
and similar for the other 2 WHEN constructs.