6.1. Add a page Column to the entries Table

Your first task is learning to identify what entries belong on what page. Essentially, you need to add a page identifier. This could be a number or a string. Your application is pretty simple, so you can just use the name of the page as your identifier.

To add this to your entries, you need to get back into your database controls, located at http://localhost/phpmyadmin. Open the simple_blog database, then the entries table. You need to add a column called page to the entries table, which will hold the name of the page to which each entry belongs.

This column cannot be blank, or the entries will get lost. To avoid this, you can set the column to NOT NULL and provide a default value. Most entries will ...

Get PHP for Absolute Beginners now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.