0

What do the <<<SQL and the SQL mean?

    $query = <<<SQL

INSERT INTO comments
    ( content )
VALUES
    ( '$content' )

SQL;

    return mysql_query( $query ) or die( mysql_error() );
}
Michael Currie
  • 13,721
  • 9
  • 42
  • 58
Ham Dlink
  • 79
  • 1
  • 3
  • 9

2 Answers2

4

In this case, it basically means same thing as this:

$query = "
INSERT INTO comments
    ( content )
VALUES
    ( '$content' )
";

More reading - http://www.php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc

Vlad
  • 795
  • 1
  • 12
  • 35
1

It's the heredoc syntax, another way to store multiline strings.

You can find it in many scripting languages.

Karoly Horvath
  • 94,607
  • 11
  • 117
  • 176