0% found this document useful (0 votes)
2 views2 pages

PHP Lesson No 5 Description

The document outlines tasks related to PHP exception handling and blog functionality in a web application. It includes instructions for adding exception handling to various scripts, checking for database connections, and displaying blog content from the database. Additionally, it specifies tasks for implementing a comment form for blog entries and storing/displaying comments in the database.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views2 pages

PHP Lesson No 5 Description

The document outlines tasks related to PHP exception handling and blog functionality in a web application. It includes instructions for adding exception handling to various scripts, checking for database connections, and displaying blog content from the database. Additionally, it specifies tasks for implementing a comment form for blog entries and storing/displaying comments in the database.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Websites for mobile devices designing

PHP lesson no 5 computer lab description

Exception handling and blog

 PHP Exception Handling, https://www.tutorialrepublic.com/php-tutorial/php-exception-


handling.php

PHP: The Right Way, https://phptherightway.com/

1. The new PHP code is added to dbPhotosCreate.php, index.php and other scripts for
exception handling and for blog displaying on home page
a. please run the dbPhotosCreate.php script to add new tables to database,
which contains blog entries and images
2. Exception and error handling code
a. onephoto.php, mynewphotos.php  check if images and thumbnails
directories exist
b. onephoto.php  check if images table was properly read from database
c. functLibrary.php / loadPhotos()  check if images table exists
d. file-upload-form.php  from the security reason don’t display this form for
the user, which is not logged in

if(!isset($_SESSION["loggedin"]) || $_SESSION["loggedin"] !== true){

// Redirect to index page

header("location: index.php");

Task 1

Please add the exception handling to scripts

a. Check if comment for images table exists in opinion.php and photoranking.php


b. Check if error occurred during database connection in config.php

3. The index.php script displays the blog content: titles, images and texts
a. the blog content is read from database tables: blogs and blogphotos;
prepared statements are used for it
b. $result->fetch_assoc() returns the associative array, indexed by column
names from database table
c. the blog entry is stored in new object of class blogContent; the new class is
defined in functLibrary.php script

1
Websites for mobile devices designing

Task 2

Please add the form to write the comment to blog text, the code to store the comment in
database and the code, which displays the comments under the blog text.

You might also like