Solution to Warning : Trying to access array offset on value of type bool in - PHP Error

Solution: Instead of $comment_text = $comment_row["comment"]; Use: $comment_text = isset($comment_row["comment"]); or $comment_text = isset($comment_row["comment"]) ?? ''; or $comment_text = $comment_row["comment"] ?? ''; or $comment_text = $comment_row["comment"] ?? null; NOTE: The idea is to check if the variable is empty and declare a default value.

Post a comment

0 Comments