Homework 9 (Kevin Bacon) FAQ

Q: On the spec, you say to be creative and make up my own page appearance and layout. So it's okay for me to completely copy the layout from the expected output images, right?
A: NO! We will paddle you fiercely and deduct hundreds of points if you do that.
Q: Why can't my code connect to webster? It says, Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'MYUWNETID'@'webster.cs.washington.edu' (using password: YES)
A: In mysql_connect, use the server name "localhost", not "webster.cs.washington.edu".
Q: Why don't my queries work in PHP?
A: Lots of students have small syntax problems in their SQL queries. The best way to find and fix them is to use the MySQL console through SSH. The console will tell you if your query has any syntax errors. Ask a TA if you don't understand the error messages. Once your query works in the console, just wrap it in quotes as a PHP string and you're nearly there.

If your query works in the console but not in PHP, try to print() the query before you run it. Then copy/paste the printed text into the console and try to run it there. Often you'll discover you are missing quotes or a semicolon or some other small syntax problem.

Q: When I try to paste a query from my text editor into the SSH MySQL console, it says something like, Display all 794 possibilities? (y or n) and doesn't run the query.
A: Queries in the console need to end with a semicolon. Also queries that occupy multiple lines shouldn't have leading tabs on any lines if you want to paste them into the console. Leading spaces are okay.
Q: What if an actor hasn't been in any films at all?
A: You may assume that this won't happen.
Q: How do I stop a form from submitting?
A: See section 9.2.4 of the textbook. A common mistake here is to listen to the click event on a button; you should not do so. Listen to the submit event on the form itself, and stop that event.
Q: My Ajax code for actorid.php isn't submitting to the right place! Why not?
A: There may be a conflict between your form's action attribute and the URL you want the Ajax to submit to.
Q: When I try to submit my form in JavaScript by calling submit() on it, nothing happens. Why not?
A: A common reason for this is when students have a button whose id is submit inside their form. This causes a conflict with the form's submit function. Choose another id for your button.
Q: How do I remove redundancy between my two pages?
A: Put common code in common.php. See the HW4 provided skeleton code as an example.
Q: When there is an "actor not found" error, does my page still have to be W3C valid?
A: Yes, it should. Before you abort your page, you can just print the few needed closing tags like </body> and so on.
Q: How do I connect the actorid Ajax search to the overall actor search form?
A: Your overall front page has a form on it. When you do the actorid Ajax search, you'll find out an ID to search for. Insert that id into your form's data to be submitted, then use JavaScript code to submit the form. A form's DOM object does have a .submit() method that you can call.
Q: Do I have to turn in the .js file?
A: Most students will need the .js file to talk to the actorid.php service. If you are doing a set of extra features that removes your need for that service, you might not need any JavaScript code. In such a case, you can turn in a blank .js file.
Q: If I do a bunch of extra features so that my search.php is basically just an Ajax service, do I still need to follow the appearance criteria in the spec about "The same title and links to the same CSS and JavaScript resources." and "The search.php page should contain a link back to mymdb.php if the user wants to start over"?
A: No; if your search.php is just a service contacted by Ajax, it doesn't make sense for it to have back links and shared resources.
Q: If I do the Ajax search feature, do I still need a "back" link like it says in the spec?
A: You should have some kind of link to restore the page to its original state.
Valid XHTML 1.1 Valid CSS! JavaScript Lint