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


Below is an example using Heredoc for SQL 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;