I have been trying the “Trivia Game”(Chapter44) shown in the “PHP6 and mySQL Bible” and have had the following problems.
When parsing the code I get the following error on three of the php files.
Parse error: syntax error, unexpected $end in C:\PHP\Trivia Game\entry_form.php on line 93
These files use the heradoc notation <<<EOT … EOT;
When I use this the remaining code appears only as text in either notepad++ or Nusphere software which means when I get to the end of the file the ?> is not the right color (meaning the same at the top) Are these issues related or is there another problem. See
"); } else { print("Entry was not successful
"); } } else { print("Upper limit must be greater than lower
"); } } function displayEntryForm () { global $PHP_SELF; $linear = CERTAINTY_LINEAR; $geometric = CERTAINTY_GEOMETRIC; $subject_string = make_subject_string(); $form_string = <<<EOT Question:
Answer: <INPUT TYPE=TEXT NAME=ANSWER
Lower: <INPUT TYPE=TEXT NAME=LOWER_LIMIT
Upper: <INPUT TYPE=TEXT NAME=UPPER_LIMIT
Level: <INPUT TYPE=TEXT NAME=LEVEL
Subject: $subject_string
Scaling type: Linear Geometric
Attribution: <INPUT TYPE=TEXT NAME=ATTRIBUTION
EOT; echo $form_string } function make_subject_string () { $result_string = ""; $query = "SELECT id, subject FROM subject ORDER BY id"; $result = mysql_query($query); while ($row = mysql_fetch_row($result)) { $id = $row[0]; $display = $row[1]; $result_string .= "$display"; } $result_string .= ""; return($result_string); } ?>