Ok, i think I have made some progress... I have changed my code to this:
$row_array = mysql_fetch_array($result);
$num_elements = count ($row_array);
for ($i = 0; $i < $num_elements; $i++) {
$row_array[$i] = nl2br(htmlspecialchars($row_array[$i]));
}
Now the problem is this, this code seems to work if I call the elements of the array by doing $row_array[1] but not when I use $row_array["comments"]
Since I almost always type out the element name, and don't use the number, this is a big problem. How do I make the associative array work, and not just the numerical!?