إعلانيمكن أن تكون علامتك التجارية هناعلامتك التجارية هنافي كل صفحة من Darslab · طلاب وأولياء أمور ومعلمونinfo@darslab.comاسأل عن الأسعارالأسعارinfo@darslab.com
☰ خطة العام · تكنولوجيا المعلومات والاتصالات (بالإنجليزية)

Term 1 review and your own mini-project

الأسبوع 15 · مراجعة الفصل الدراسي الأول (الوحدات ١–٣) ومشروع صغير من تصميمك · 3 دروس
1

Review: web pages, servers and planning a site

ICT Secondary 2 Term 1, Review: pp. 7–113
GoalReview web pages, servers, the plan of a site and its tables with new mixed tasks.
New words
static page · a page whose content is the same for every visitor until someone edits the filedynamic page · a page built by a script, often from a database, when it is asked forprimary key · the field whose value is different in every recordforeign key · a field that holds the primary key of another table
Explanation

This week we look back over Units 1 to 3, using new tasks and not the questions of the book. Start with sorting. A page that shows the same text to everybody is static; a page that PHP builds from the Terms table is dynamic and must be asked from a server that can run PHP. Work you do on your own computer with a local server is localhost; a site that visitors reach from other places is on hosting. A free program costs nothing, and an open source program also lets you read and change its code. Then the tables: each record is one row, each field is one column, and the primary key (remember: different in every record) names the record. When two tables are linked, the foreign key sits on the “many” side. For one club with many loans, the Loans table keeps the member number. Last, remember that 1 KB is 1,024 bytes, so a file of 2,048 bytes is 2 KB.

SituationStatic or dynamic?Needs PHP?
a Help page with fixed textstaticno
a list of terms read from the tabledynamicyes
a page that shows today’s datedynamicyes
a page of club rules that never changesstaticno
Worked examples
Sql
1CREATE TABLE Members (member_id INT NOT NULL PRIMARY KEY, nick VARCHAR(30) NOT NULL, level VARCHAR(10));
2CREATE TABLE Loans (loan_id INT NOT NULL PRIMARY KEY, member_id INT NOT NULL, book VARCHAR(50) NOT NULL, FOREIGN KEY (member_id) REFERENCES Members(member_id));
Classify the fields of the invented Members table: member_id is a number and the key; nick is short text; level is short text that may stay empty. Here is the table as SQL, together with a Loans table that points to it. Which line makes the link?
Sql
1SELECT Term FROM Terms WHERE id > 1;
Output
Term
cable
browser
Write the SQL for a described change on the Terms table of Week 7, which has three records. “Show every term except the first.” The result lists the two terms with a larger id.
Sql
1DELETE FROM Terms WHERE id = 1;
Output
1 row affected
Another change: remove the first record. One row is affected, and the table keeps two records.
Class activity

On paper sort these eight items into two lists, “runs on the server” and “runs in the browser”: PHP code; a JavaScript check of an empty box; an SQL INSERT; showing the finished HTML page; the include of header.php; choosing a picture file in the form; a query on the Terms table; the page title in the title bar. Then say what kind of key id is in the Terms table. Add one sentence: which table of a club has the foreign key, Members or Loans, and why?

Practice
1
A visitor opens a page that lists terms from the table. Static or dynamic?
2
What is the difference between localhost and hosting?
3
One member has many loans. Which table holds the foreign key?
4
How many KB is a file of 3,072 bytes? Say what you used for 1 KB.