Creating A Web App For Creating and Displaying Posts
The document provides instructions for creating a web application to create and display blog posts. It involves creating a database table, a form view, a model, and a controller to manage inserting and retrieving posts from the database and displaying them.
Download as DOCX, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
24 views
Creating A Web App For Creating and Displaying Posts
The document provides instructions for creating a web application to create and display blog posts. It involves creating a database table, a form view, a model, and a controller to manage inserting and retrieving posts from the database and displaying them.
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1
Creating a Web App for Creating and Displaying Posts.
Instructions: (3 pts each).
1. Create a table named ‘blogposts’ with 5 fields in your database ciblog_surname 2. The following are the fields and the attributes: a. id INT 32 primary key/auto increment b. title VARCHAR 255 c. body VARCHAR 255 d. username VARCHAR 255 e. date_created TIMESTAMP default: CURRENT_TIMESTAMP 3. In your views folder, create a new folder named ‘blogposts’ and inside that folder create a file named ‘posts.php’ . 4. In your posts.php file, create some html code with a form that will display the following(you can put design if you want): a. 1 textbox for title b. 1 textarea for body c. 1 textbox for username d. 1 button for submitting the form. 5. Inside you models folder, create a new file named ‘Posts_model.php’ and inside that file create a model and the necessary functions to insert and get data to and from the database. 6. Update autoload.php to load the model automatically. 7. In your Controllers folder, create a file named ‘Posts.php’ and inside that file create a controller and the necessary functions to manage the view file and control the model. 8. Edit the action attribute of the form in your posts.php file. 9. Edit your view file ‘posts.php’ display all the posts from the database. You will only display the title, body, username and the date created (design is of your choice). 10.The application should be able to create and display posts.