Heredoc is one of the useful solution to secure better readability when we code SQL Query in PHP

Below is an example using Heredoc for SQL Query in PHP

	$sql = <<<SQL
		select *
		from class
		where grade>5
	SQL;

Below is another example using Heredoc with variables for SQL Query in PHP

	$sql = <<<SQL
		insert into celebrity( id, name, gender, year, month, day, hour, lunar, img, thumbnail, created_at, updated_at, active)
		values('{$id}', '{$name}', '{$gender}', {$yy}, {$mm}, {$dd}, {$hh}, '{$lunar}', '{$new_img_filename}', '{$new_thumbnail_filename}', '{$now}', '{$now}', true)
	SQL;