Homework1 for Week 4
1、Give the SELECT command to answer the question Who will go to the party held in Peking University?
- SELECT Guest_Name
- FROM guest,party,guest_party
- WHERE party.Party_Num=guest_party.Party_Num
- AND guest_party.Guest_ID=guest.Guest_ID
- AND Place='Peking University'
2、Figure out a way to obtain the column labels returned by mysql_fetch_array.
- print("<p>The Column Labels is:");
- $row=mysql_fetch_array($result);
- while($item = each($row))
- {
- $label = $item["key"];
- print("\'$label\'");
- }
- print("</p>");
3、Tell the difference between a CGI program and a PHP program executed by a Web Server.
When we request for a page, there is a way for each program executed by a web server.
PHP programs:
user (client) request for page --> webserver(-> embedded PHP interpreter) --> Server side(PHP) Script --> MySQL Server.
CGI programs:
user (client) request for page --> webserver --[CGI]--> Server side Program --> MySQL Server.
In addition, the PHP code can be embed in html but the CGI programs should be seperated from web pages files.
Homework2 for Week 4
Homework3~5 for Week 4