Personal Catalogue: PHP & MySQL — Chapter 3, Exercise 1 ==================================================== TASK Wire up add_item.php against the real catalogue database and add three items: one book, one CD, and one DVD. Confirm all three appear correctly with SELECT * FROM items;, including that each row's unused columns (e.g. a DVD's own creator) are stored as NULL, not an empty string. SOLUTION With config.php, functions.php, and add_item.php in place and pointed at the real catalogue database, visiting add_item.php in a browser and submitting the form three times with: Type: book Title: Fluent Python Creator: Luciano Ramalho Format detail: paperback Release year: 2022 Notes: (left blank) Type: cd Title: The Dark Side of the Moon Creator: Pink Floyd Format detail: album Release year: 1973 Notes: (left blank) Type: dvd Title: The Matrix Creator: (left blank) Format detail: (left blank) Release year: 1999 Notes: (left blank) Then, at the mysql> prompt: SELECT * FROM items; Expected output (id/created_at values will differ): +----+--------------+----------------------------+-------------------+----------------+--------------+-------+ | id | item_type_id | title | creator | format_detail | release_year | notes | +----+--------------+----------------------------+-------------------+----------------+--------------+-------+ | 1 | 1 | Fluent Python | Luciano Ramalho | paperback | 2022 | NULL | | 2 | 2 | The Dark Side of the Moon | Pink Floyd | album | 1973 | NULL | | 3 | 3 | The Matrix | NULL | NULL | 1999 | NULL | +----+--------------+----------------------------+-------------------+----------------+--------------+-------+ Confirming NULL rather than empty string specifically: SELECT title, creator IS NULL AS creator_is_null FROM items WHERE title = 'The Matrix'; Expected: creator_is_null returns 1 (true) — the column genuinely holds NULL, not an empty '' value. WHY THIS WORKS AS AN ANSWER ---------------------------- It actually exercises all three real item types through the live form rather than only inserting rows by hand, and specifically verifies the NULL-vs-empty-string distinction with an IS NULL check rather than just eyeballing the output, since a blank-looking cell in a terminal can't always be trusted to distinguish the two.