O'Reilly logo

PHP Application Development with NetBeans Beginner's Guide by M A Hossain Tonu

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action — creating a class, adding a constructor, and creating methods

We will create the StatusPoster.php file and the class skeleton using the NetBeans code template, and to create methods within the class, we will use the function template as well. We will create a MySQL database connection using a PDO inside the class constructor, so that the database connection is created along with the object instantiation and getStatusPosts() method to fetch the status posts from the table.

  1. From the Projects pane, right-click on project name chapter3, select New | PHP File..., and name the file StatusPoster, as shown in the following screenshot:
    Time for action — creating a class, adding a constructor, and creating methods

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required