Homework 4 (NerdLuv) FAQ
-
Q: Why does my page say "file_put_contents: Permission denied" when I try to write a file?
-
A: You may have an issue with your file permissions on Webster. See the section of the spec about file permissions to learn how to fix it. Email your TA if you can't fix it.
-
Q: Can a person have 0 matches? 1 match? A whole bunch? How should I handle each case?
-
A: Yes, it's possible to have 0 matches. See the Stewie Griffin example output on the web site. You should treat every case the same; you don't need a special case for 0 matches or 1 match. Just don't show any matches if the person doesn't have any.
-
Q: Can I assume that every person's name will be in the format "FIRST LAST"?
-
A: No. Every name will be a non-empty string, but some names are just one word ("Leeloo") and others have more than two words ("Rosie O Donnell", "Angry Video Game Nerd").
-
Q: What if the user types in bad data, empty data, data with funky characters in it, etc.?
-
A: We won't test for this. You may assume that the user fills out the entire form with valid non-empty values without special characters in them.
-
Q: How do I compare strings in PHP?
-
A: You can use ==, !=, <, >, etc. Or use functions like
strcmp
.
-
Q: My code says, "
Fatal Error: Cannot redeclare (something)
". Why?
-
A: You are include()ing the same thing twice. Change your
include
calls to include_once
(which does nothing if that file has already been included before) or remove the second include
call.
-
Q: How do I validate the page?
-
A: View Source on the page in Firefox and copy/paste that into the validator.
-
Q: How do I compare the page in the Web Page Comparison Tool?
-
A: Point the HTML diff tool to index.php, and then fill out the form and submit it. Then you can use the diff tool as normal on the resulting pages that appear.
-
Q: My text boxes on the form look a bit wider than the ones in the expected output. But I am sure I used the size values from the spec. What is wrong?
-
A: The screenshots were taken on Windows XP. Later versions of Windows, such as Vista or Windows 7, may draw the text boxes wider. If you are certain that you used the size attribute values from the spec, you are probably okay. If you want to be sure, you can try double-checking it by going to the IPL and viewing it on one of those computers before turning in your program.
-
Q: What does this error mean?
Fatal error: Maximum execution time of 30 seconds exceeded in /path/to/myfile.php on line #
-
A: It means you have an infinite loop in your code, so PHP timed out.
-
Q: Why does the
file_exists
function always return FALSE
for me?
-
A: You might be using a bad file name/path string. Try printing it out to see its value. Also don't use a leading "/" character in the string, because that searches in Webster's root directory.
-
Q: What does this error mean?
Parse Error: syntax error, unexpected $end in ... myfile.php on line #
-
A: You are missing a } or ) closing brace character. TextPad and other editors can do brace matching. In TextPad, select the brace and press Ctrl-M to see its match.