MySQL error #1064 while creating a trigger
There are two problems

PROBLEM #1 : ENDIF is wrong. It's END IF

PROBLEM #2 : END IF $$ is wrong. It's END IF;

This is how it should appear

DELIMITER $$
DROP TRIGGER IF EXISTS brandRep $$
CREATE TRIGGER brandRep AFTER UPDATE ON sales_flat_order
 FOR EACH ROW
BEGIN
IF (NEW.status &lt;&gt; OLD.status AND OLD.applied_rule_ids &lt;=&gt; 45182) THEN
    UPDATE reps_transaction_history_ids
    SET order_status = NEW.status 
    WHERE order_id = OLD.increment_id;
END IF;

END $$
DELIMITER ;


Give it a Try !!!