අන්තර්ගතයට යන්න
mcqdinethlive

PHP and MySQL past paper questions and 2027 predictions

Every PHP, MySQL and HTML form question from 2019 to 2026, sorted by sub-skill and Bloom's level, with the gaps, the book errors and a careful thought experiment on what the 2027 paper can ask next.

සිංහලෙන් කියවන්න

This post counts what the A/L ICT papers have asked on PHP and MySQL, and reasons about what the 2027 paper can ask. PHP with a database is a favourite topic of the examiners. It comes with SQL from Unit 8, and with HTML forms from Unit 10. The past papers show this.

The post has five parts:

  • How the exam asks it: the five-part web question, its place in the paper and its marks from 2019 to 2026 (sections 1 and 2).
  • What the papers asked and did not ask: the sub-skills tested, their Bloom's revised levels and the gaps (sections 3 to 5).
  • What 2027 can ask: a thought experiment with numbers and judgement (section 6).
  • What to watch for: errors in the books and the papers (section 7).
  • How to practise: past paper questions to try (section 8).

1. How the exam asks PHP and MySQL

The exam asks PHP and MySQL as one web question with five parts. The syllabus puts PHP and MySQL in competency level (10.7) "Creates dynamic web pages using PHP and MySQL" (Syllabus 10.7, pages 43 and 44) (විෂය නිර්දේශය 10.7, පිටු 40 සහ 41). The Sinhala syllabus calls it "PHP සහ MySQL භාවිත කොට ගතික වෙබ් පිටු (dynamic web pages) නිර්මාණය කරයි". The SQL itself is in its own level (Syllabus 8.3, pages 32 and 33) (විෂය නිර්දේශය, පිටු 31 සහ 32). The Sinhala syllabus numbers that SQL level 8.6, not 8.3. Its 8.3 is the logical schema level.

One question with five parts

A full web question has five parts, and the examiners take one or more parts each year.

  1. The HTML form: action, method and the input elements.
  2. The PHP script: it reads the form data with $_POST and runs SQL.
  3. The SQL query: SELECT, INSERT and the other SQL statements (8.3).
  4. The MySQL database: the tables and the rows.
  5. The output page: PHP uses echo to build HTML from the rows.

The Teachers' Guide names the same chain: web browser, scripting language, server and database software (Teachers' Guide 10.7, pages 94 and 95) (ගුරු අත්පොත 10.7, පිටුව 95). The Sinhala Guide lists "වෙබ් අතරික්සු", "පිටපත්කරණ භාෂාව", "සේවාදායක" and "දත්ත සමුදාය කළමනාකරණ මෘදුකාංග".

Where it sits in the paper

Paper II, Part A, Q1 was the web question in all 8 new-syllabus papers. In 2025 and 2026, Part B, Q10 also had PHP. Part B is a choice: students answer 4 of its 6 questions. So the Part A question is the one that every student must answer.

2. Marks from 2019 to 2026

The Paper II marks for PHP and MySQL (10.7) rose in most years. Only 2026 dropped, from 16 to 13. The Paper I questions went down.

The numbers

  • Paper II marks for PHP and MySQL (10.7) were 3, 4, 5, 6, 7, 9, 16 and 13, from 2019 to 2026. That is 63 marks in total.
  • A straight-line fit gives about +1.7 marks each year.
  • Paper I had 4, 2, 3, 2, 1, 1, 0 and 1 questions on PHP and MySQL (10.7). That is 14 questions in total.
  • PHP code was in Paper II in 7 of the 8 papers. Only 2021 had no PHP code in Paper II.

How much to trust the numbers

The 2019, 2020, 2021 and 2025 marks are official, and the rest are less sure. The 2023 (held 2024) paper has no marking scheme, so its 7 marks are an estimate. The 2022 and 2024 marks come from third-party schemes.

The old-syllabus papers (2011 to 2018) had no PHP. They asked HTML forms and JavaScript. Use them for practice only, never as evidence of the current pattern.

3. What the papers have tested

The form attributes, the input elements and the database link come back most often. We split PHP and MySQL (10.7) into small sub-skills, such as "the action attribute" or "SELECT from PHP". Then we marked each paper that asked each sub-skill.

The parts that come back

  • The form attributes: action was in 6 of 8 papers and method in 5 of 8.
  • The input elements: select (5 of 8), radio buttons (4), submit (4), text input (3) and check boxes (3).
  • The database link: connect to MySQL (5 of 8), run a query (4), and SELECT from PHP (4).
  • Saving form data: INSERT from PHP (3 of 8) and reading $_POST (3 of 8).

Two parts from outside the books

Two parts came from outside the syllabus and the Resource Book:

  • HTML5 validation (type="email", pattern, a date field) was in 2024, 2025 and 2026.
  • The hidden input was in 2025 and 2026.

Neither one is in the syllabus contents (Syllabus 10.7, pages 43 and 44) (විෂය නිර්දේශය 10.7, පිටු 40 සහ 41). We did not find them in the Resource Book either (Resource Book 10.7, pages 112 to 117) (Resource Book 10.7, පිටු 124 ඉඳන් 129). Learn them anyway, because the papers ask them now. MDN explains both (see the sources at the end).

4. Bloom's revised levels in the questions

Most PHP and MySQL marks are at the Apply level. Bloom's revised taxonomy has six levels: Remember, Understand, Apply, Analyse, Evaluate and Create (Anderson and Krathwohl, 2001). Lessons often follow these levels. So we put each PHP and MySQL question (10.7) at one level.

One example for each level

  • Remember: give the order of the mysqli_connect parameters (2026 Paper I, Q46).
  • Understand: say what the action attribute does (2024 Paper II, A, Q1(a)(ii)).
  • Apply: fill the blanks of a form or a PHP script (2023 (held 2024) Paper II, A, Q1(b)).
  • Analyse: put the code blocks of a database page in the correct order (2020 Paper II, A, Q1(c)(i)).
  • Evaluate: judge why the server must check the table before it saves a booking (2025 Paper II, B, Q10(c)).
  • Create: no paper has asked students to write a whole PHP page from nothing.

What the counts say

  • Apply has 44 of the 63 Paper II marks, which is 70%.
  • Understand has 13 marks. Analyse has 4. Evaluate has 2.
  • Remember questions are all in Paper I, so they have no Paper II marks.
  • The examiners asked students to find an error in HTML (2021 (held 2022) Paper II, A, Q1(a)(i)). They asked the same for CSS (2026 Paper II, A, Q1(a)(ii)). They have never asked it for PHP or SQL.

5. What the papers have not tested

A gap is a part that the syllabus or the Resource Book teaches, but no new-syllabus paper has asked. The biggest gap is updating and deleting data from PHP.

The CRUD gap

CRUD means Create, Read, Update and Delete. These are the four jobs of a database page.

  • Create and Read came many times. INSERT was in 5 of 8 papers and SELECT in 8 of 8. Both also came inside PHP code.
  • Update came 4 times as plain SQL, but never inside PHP code.
  • Delete never came as SQL code. 2025 Paper II, B, Q10(d) talks about removing old records, but in words, not as a statement.

The Resource Book teaches both missing pages. It shows an update page and a delete page in PHP (Resource Book 10.7, pages 121 and 122) (Resource Book 10.7, පිටු 133 සහ 134). The syllabus also says "Add, modify and delete data" for programs (Syllabus 9.12, page 40) (විෂය නිර්දේශය 9.12, පිටුව 37). The Sinhala syllabus writes "දත්ත එක් කිරීම(add), නවීකරණය (modify) සහ මැකීම(delete)". So the gap is in the papers, not in the syllabus.

This is the Resource Book style of an update page. Study how it is built, then change it to a delete page as practice.

<?php
$conn = mysqli_connect("localhost", "root", "", "school");
if (!$conn) {
  die("Connection failed: " . mysqli_connect_error());
}
$id  = $_POST['st_id'];
$tel = $_POST['tel'];
$sql = "UPDATE Student SET Tel = '$tel' WHERE StID = '$id'";
if (mysqli_query($conn, $sql)) {
  echo "Record updated";
}
mysqli_close($conn);
?>

Thirteen parts never asked

These 13 parts have 0 of 8 papers so far:

  • PHP language: user-defined functions, switch, for and while loops, foreach with key arrays, and the sort functions (Resource Book 10.7, pages 100 to 107) (Resource Book 10.7, පිටු 112 ඉඳන් 119).
  • Forms: the reset button, reading $_GET from the URL, and isset before a field is read (Resource Book 10.7, pages 113 and 117) (Resource Book 10.7, පිටු 125 සහ 129).
  • PHP with MySQL: UPDATE and DELETE from PHP, escaping the input, and closing the connection (Resource Book 10.7, pages 118 to 122) (Resource Book 10.7, පිටු 130 ඉඳන් 134). Also a JOIN inside PHP (Syllabus 8.3, 10.7).

Functions have the strongest claim. The syllabus names "Functions" in the PHP contents (Syllabus 10.7, page 43) (විෂය නිර්දේශය 10.7, පිටුව 40), and the Sinhala Teachers' Guide calls them "ශ්‍රිත (functions)" (ගුරු අත්පොත 10.7, පිටුව 94). Many of the others are only in the Resource Book.

6. A thought experiment for 2027

The 2027 paper will probably ask at least one part that it has never asked, and the best guesses close the CRUD gap. We use two simple tools, and then we add judgement.

Tool 1. How often a part comes back

The rule of succession gives a first guess for one sub-skill. Say it came in k of the n = 8 papers. A fair first guess for "it comes next year" is (k + 1) / (n + 2).

  • action came in 6 of 8 papers. The guess is 7 / 10, so 70%.
  • SELECT from PHP came in 4 of 8. The guess is 50%.
  • A part with 0 of 8 gets 1 / 10, so 10%.

With only 8 papers, each guess is very loose. The Wilson 95% interval shows how loose. For 6 of 8 it runs from 41% to 93%. For 0 of 8 it runs from 0% to 32%. So the data cannot tell a 10% part from a 30% part.

Tool 2. How many parts are new each year

The second tool counts the sub-skills that a paper asked for the first time. The counts are 8, 6, 6, 3, 0, 2, 6 and 1. The early papers had many new parts, because everything was new then.

The last 4 papers average 2.25 new parts each. If 2027 behaves like them, a Poisson model gives:

  • no new part: about 11%
  • 1 to 3 new parts: about 70%
  • 4 or more new parts: about 19%

So the data says something useful. The 2027 paper will probably ask at least one part that it has never asked. It cannot say which part.

Adding judgement

The numbers alone treat all 13 gaps the same, but they are not the same. We ranked them with four signals:

  1. Source: a part in the syllabus ranks above a part that is only in the Resource Book.
  2. Pattern: a part that completes a pattern the papers already started, such as CRUD, ranks higher.
  3. Trend: a part that fits the trend to longer Paper II code questions ranks higher.
  4. Size: a part must fit into a 2 to 4 mark question part.

The ranked guesses

  • Almost sure: a form with action and method, a connection, a SELECT or INSERT, and $_POST. These came again and again.
  • High: UPDATE from PHP, and DELETE as SQL or in PHP. They close the CRUD gap, and the Resource Book shows both pages.
  • Medium high: a user-defined PHP function. The syllabus names functions, and Unit 9 already asks functions in Python.
  • Medium: $_GET and URL values, and isset or a duplicate check written as code. Also: find the error in PHP or SQL code, the reset button in Paper I, and a trace of a foreach, switch or loop.
  • Low medium: a JOIN inside PHP; SQL injection and escaping as an Evaluate question.
  • Low: write a whole PHP page from nothing. That is the Create level, and it needs more marks than one part of Q1 has.

The Bloom's level to expect

Apply will stay the largest part, and the new parts will probably push up one level. The 2025 and 2026 papers already asked "why" questions about hidden fields and server checks. So expect one or two Analyse or Evaluate parts, such as "find the error" or "why must the server check this".

7. Errors in the books and the papers

The books and the papers have errors on this topic, in both media. Know them, so that they do not cause confusion in the exam.

Errors in the Resource Book

The Sinhala Resource Book has the same errors as the English one, 12 pages later. Each item gives the English page first.

  • Page 101: the array example declares $fruits, but then uses count($cars) and $cars[$x]. Use one array name (Resource Book 10.7, page 101) (Resource Book 10.7, පිටුව 113).
  • Page 101: the book says "to sort an array in descending order", but the code uses sort(). sort() sorts in ascending order. rsort() sorts in descending order (Resource Book 10.7, page 101) (Resource Book 10.7, පිටුව 113). The Sinhala page also contradicts itself: it says descending ("අවරෝහණ") before the code and ascending ("ආරෝහණ") after it.
  • Page 102: $age1 > age2 has no $ before age2. Page 103 sets $Marks, but tests $age1 (Resource Book 10.7, pages 102 and 103) (Resource Book 10.7, පිටු 114 සහ 115).
  • Page 106: the function is printNameAndYear, but the code calls familyName(...). Call the function that is defined (Resource Book 10.7, page 106) (Resource Book 10.7, පිටුව 118).
  • Page 116: the book says "use the <selected> tag". selected is an attribute of the option element, not a tag (Resource Book 10.7, page 116) (Resource Book 10.7, පිටුව 128). The Sinhala book calls it the "<selected> උසුලනය".
  • Page 117: the book says POST data "is invisible to others" and "has no limits". POST data is not in the URL, but it is not encrypted. Only HTTPS protects it. The server also sets a size limit (post_max_size in PHP) (Resource Book 10.7, page 117) (Resource Book 10.7, පිටුව 129).
  • Page 122: the delete example prints Ssql for $sql and has no quotes around the text value. It misses a quote in $_POST['st_Nic']. It also prints "Record updated successfully" after a delete (Resource Book 10.7, page 122) (Resource Book 10.7, පිටුව 134).

Errors in the Teachers' Guide

  • Page 95 lists "WAMP, XWAMP" and "XAMP" as server packages. The real name is XAMPP (Teachers' Guide 10.7, page 95) (ගුරු අත්පොත 10.7, පිටුව 95). The Sinhala Guide prints "WAMP, XAMP" and "XAMP/WAMP/LAMP", so it has the "XAMP" error but not "XWAMP".
  • Page 94 gives PHP and MySQL only 6 periods (Teachers' Guide 10.7, page 94) (ගුරු අත්පොත 10.7, පිටුව 94). The Sinhala Guide also says "කාලච්ඡේද 06". The level carries 13 to 16 Paper II marks now. Plan more time than the guide gives.

Misprints in the papers

The question papers also have misprints. Read the code carefully, and write the correct form in the answer.

  • 2022 (held 2023) Paper I, Q48: mysqli connect_error without the underscore, and a missing semicolon.
  • 2022 (held 2023) Paper II, A, Q1(c) and Q1(d): text inside <head>, "Studnet", "Prefered", and an echo string with no closing quote.
  • 2023 (held 2024) Paper II, A, Q1(c): $_POST(['news-letter'], a curly quote, and </form with no >.
  • 2023 (held 2024) Paper I, Q32: a > ANY subquery, which is outside the syllabus.
  • 2024 Paper II, A, Q1(b): the question calls PHP code "HTML code".
  • 2025 Paper II, A, Q1(c) and B, Q10: brackets in the wrong place, and <table> where </table> belongs.
  • 2026 Paper I, Q46: the call has five arguments and a trailing comma, but the options explain only four.

8. Past paper questions to try

Try each question before looking at any answer. The section in brackets helps.

Forms:

  • 2019 Paper I, Q31: GET and POST compared (section 3).
  • 2022 (held 2023) Paper II, A, Q1(c): complete a registration form (sections 1 and 3).
  • 2023 (held 2024) Paper II, A, Q1(b): fill the blanks of a form (section 3).
  • 2024 Paper II, A, Q1(a): a form with validation parts (sections 3 and 4).
  • 2026 Paper II, A, Q1(a)(i): a form with a label, a date and a select (section 3).

Connect and SELECT:

  • 2020 Paper II, A, Q1(c): order the code blocks, then give the output (sections 4 and 5).
  • 2024 Paper II, A, Q1(b): show records from a table (section 3).
  • 2025 Paper II, A, Q1(c): a page that fills a form from the database (sections 3 and 5).
  • 2026 Paper I, Q46: the mysqli_connect parameters (section 3).
  • 2026 Paper II, B, Q10(b): an event registration page (sections 3 and 5).

INSERT and $_POST:

  • 2019 Paper II, A, Q1(c): connect and save form data (section 5).
  • 2022 (held 2023) Paper II, A, Q1(d): read and show the form data (section 3).
  • 2023 (held 2024) Paper II, A, Q1(c): build an INSERT from the form data (sections 3 and 5).
  • 2026 Paper II, A, Q1(b): read the form data with $_POST (section 3).

Reasoning parts:

  • 2021 (held 2022) Paper I, Q50: an array and a string join (section 3).
  • 2025 Paper II, A, Q1(d): what one line of PHP shows (section 4).
  • 2025 Paper II, B, Q10(b): if statements over fetched rows (sections 4 and 6).
  • 2025 Paper II, B, Q10(c): why the server checks before it saves (sections 4 and 6).

SQL on its own (8.3):

  • 2019 Paper I, Q50 and 2024 Paper I, Q36: UPDATE (section 5).
  • 2022 (held 2023) Paper II, B, Q9(b): SELECT with a join (section 6).
  • 2023 (held 2024) Paper II, B, Q9(d): CREATE TABLE, INSERT and SELECT (section 5).
  • 2026 Paper I, Q28 and Q29: constraints and an INSERT that breaks them (section 5).

Sources outside the syllabus

The syllabus, Teachers' Guide and Resource Book pages are cited in the text. These are the other sources:

  • Lorin W. Anderson and David R. Krathwohl (eds.), A Taxonomy for Learning, Teaching, and Assessing, Longman, 2001. Overview: David R. Krathwohl, "A Revision of Bloom's Taxonomy: An Overview", Theory Into Practice 41(4), 2002. DOI, Wikipedia.
  • Rule of succession. Wikipedia.
  • Wilson score interval. Wikipedia.
  • Poisson distribution. Wikipedia.
  • PHP manual: MySQLi. php.net.
  • PHP manual: $_GET, isset and sort. $_GET, isset, sort.
  • PHP manual: post_max_size. php.net.
  • PHP manual: mysqli_real_escape_string and prepared statements. escape, prepared statements.
  • OWASP: SQL injection. owasp.org.
  • MDN: the hidden input, the option element, and form validation. hidden, option, validation.
  • XAMPP, the server package. Apache Friends.

මේ Explained එක බෙදාගන්න

A/L ICT කරන යාළුවෙකුට යවන්න.

මේ ලිපියට link කරන ලිපි

  1. English

    Database design from ER diagrams to normal forms and SQL

    The A/L ICT database unit (Unit 8) through one school club register. How the papers ask it, the ER diagram, the tables and keys, the constraints, the normal forms, SQL, the joins with other lessons and past paper questions by step.

  2. English

    Systems analysis and design questions and the lessons they join

    How A/L ICT papers test systems analysis and design (Unit 7), how one system joins Python, databases, web and business, and a step-by-step path to learn it by building a small system.

  3. English

    Cross-unit A/L ICT questions not asked yet

    The A/L ICT unit pairs the paper has joined from 2019 to 2026, a test of the idea that Paper II topics return in next year's Paper I, six syllabus-based combinations not asked yet, a 2027 watch list and past papers to try.

  4. English

    Units 1 to 5 carry a quarter of the A/L ICT marks

    The first five units get a quarter of the syllabus periods and a quarter of the past paper marks, and that evidence also says something about Bloom's levels.

  5. English

    A/L ICT 13 units by weight and Bloom's level

    A map of all A/L ICT units with their syllabus periods, their past paper marks from 2019 to 2026 and their Bloom's levels. It checks a common teachers' argument against the evidence and shows what the paper can change.

  6. English

    The PHP questions not asked yet

    Since 2019 the papers asked PHP to save and show records, but never to update or delete them. That gap matters for 2027 revision.

තවත් Explained

  1. Layer 2 vs Layer 3 switch differences and real uses

    How a Layer 2 switch and a Layer 3 switch differ, why each exists, where networks use them now and next, and the A/L ICT past paper questions that test them, with answers.

    Englishපියවර 7ක්
  2. A/L ICT second attempt study plan for 2027 by unit weight and past papers

    A study plan for students who sit A/L ICT again in 2027. It covers the 2026 results, the units that carry most marks, a lesson method with past papers, a month by month timeline and the free papers on this site.

    Englishපියවර 7ක්
  3. Python functions with lists of tuples and sequential search in 2026 Paper II Q9

    2026 Paper II Q9 worked part by part. The fine rule and its two readings, a function with if and elif, a list of tuples built with a loop, a sequential search that returns -1, and the same skills in Paper I.

    Englishපියවර 7ක්
All Explained