<title>Current To-do List</title>
'; foreach ($parent as $task _id = $todo) {echo <<
$todoEOT; if (Isset ($tasks [$task _id])) {//If the current ID has subtasks, the menu make_list is created recursively ($tasks [$task _id]); } echo ""; } Echo ''; } $db = Mysqli_connect (' 192.168.31.172 ', ' root ', ' root ', ' phpadvanced '); Mysqli_query ($db, "Set names UTF8"); if (($_server[' request_method ' = = ' POST ') && isset ($_post[' tasks ') && Is_array ($_post[' tasks ') &&!empty ($_post[' tasks ')) {$q = ' UPDATE tasks SET date_completed=now () WHERE task_id in ('; foreach ($_post[' tasks ') as $task _id = $v) {$q. = $task _id. ', '; } $q = substr ($q, 0,-2). ')'; $r = Mysqli_query ($db, $q); if (mysqli_affected_rows ($db) = = Count ($_post[' tasks ')) {echo '
The selected task is already marked complete
'; } else {echo '
The selected task cannot be marked as complete
'; }} $q = ' SELECT task_id, parent_id, task from Tasks WHERE date_completed= ' 0000-00-00 00:00:00 ' ORDER by parent_id, date_added ASC '; $r = Mysqli_query ($db, $q); $tasks = Array (), while (list ($task _id, $parent _id, $task) = Mysqli_fetch_array ($r, Mysqli_num)) {$tasks [$parent _id][$t ASK_ID] = $task;} Echo '
'. Print_r ($tasks, 1). '
';//This is the original document, Heredoc format echo <<
<>
Click the check box to mark the completion. (the task itself is already all subtasks will not appear in this list)
EOT;? >
The above describes the PHP heredoc original document and Nowdoc syntax, including the aspects of the content, I hope that the PHP tutorial interested in a friend helpful.