About <<<MySQL ..... MySQL;

private function buildDB() {
$sql = <<<MySQL_QUERY
CREATE TABLE IF NOT EXISTS testDB (
title VARCHAR(150),
bodytext TEXT,
created VARCHAR(100)
)
MySQL_QUERY;

return mysql_query($sql);

}

what does it mean by :<<<MySQL in this php method? I want a clear idea about it

It means a malformed string.

<< is a bitwise shift operator.
" is a string starter.
<<< can be a HEREDOC or NOWDOC declared string (which… is what this appears to be attempting to do).
Based on the rest of the lines, it should say $sql = <<<MySQL_QUERY CREATE...

You need to be aware if you’re not already that the mysql_* extension was depreceated in version 5.5 of PHP and is being removed in version 7. You should now be using either the mysqli_* extension or PDO. Whether you use the mysqli_* extension or PDO, remember to always use prepared statements when dealing with any user submitted data in a query.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.