$i = $integer;
…is redundant, as soon as you say
for($i = ..., $i will be overwritten. In your case, so it should be. Take that line out to start with.
Second, I think the problem you’re having is that your lines aren’t showing as black or red. Reason is that
color is a font attribute and you should look at this post to find out how to change your color:
Changing the color of an hr element
I suggest using
class="red" in your PHP and setting classes up in your CSS.
solved PHP: for-loops and if-statement