Blog

python tutorials and learn python

Created with Sketch.

PHP PDO MySQL

PHP PDO MySQL Summary: in this tutorial, you will learn how to create a new sample database in MySQL for practicing with PDO. Creating a database First, log in to the MySQL database using the root user from the Command Prompt on Windows or Terminal on macOS and Linux: mysql -u root Code language: Shell…
Read more

Connecting to PostgreSQL

Connecting to PostgreSQL Summary: in this tutorial, you will learn how to connect to a PostgreSQL database server using PHP PDO. Prerequisites To make a connection to the PostgreSQL database server using PHP PDO, you need to have: A PostgreSQL database server, a database, and an account with a username and password that can access…
Read more

Connecting to MySQL

Connecting to MySQL Summary: in this tutorial, you’ll learn step by step how to connect to a MySQL database from PHP using PDO. Prerequisites Before connecting to a MySQL database server, you need to have: A MySQL database server, a database, and an account that has access to the database. PDO MySQL driver enabled in…
Read more

PHP PDO

PHP PDO PHP PDO is a database access layer that provides a uniform interface for working with multiple databases. PDO simplifies the common database operations including: Creating database connections Executing queries using prepared statements Calling stored procedures Performing transactions And handling errors PDO allows you to work with any database that has a PDO driver…
Read more

PHP Anonymous Class

PHP Anonymous Class Summary: in this tutorial, you’ll learn how about the PHP anonymous class and how to define anonymous classes. Introduction to the PHP anonymous classes So far, you have learned how to define a new class with a name. For example: <?php class MyClass { // … } Code language: PHP (php) The…
Read more

PHP property_exists

PHP property_exists Summary: in this tutorial, you’ll learn how to use the property_exists() function to check if the object or class has a property. Introduction to the PHP property_exists function The property_exists() function returns true if an object or a class has a property. Otherwise, it returns false. Here’s the syntax of the property_exists() method:…
Read more

PHP method_exists

PHP method_exists Summary: in this tutorial, you’ll learn how to use the PHP method_exists() function to check if a class or an object of a class has a specified method. Introduction to the PHP method_exists function The method_exists() function returns true if an object or a class has a specified method. Otherwise, it returns false.…
Read more

PHP class_exists

PHP class_exists Summary: in this tutorial, you’ll learn how to use the PHP class_exists() function to check if a class exists or not. Introduction to the PHP class_exists() function The class_exists() function accepts a class name and returns true if the class exists or false otherwise. class_exists(string $class, bool $autoload = true): bool Code language:…
Read more

PHP Set Exception Handler

PHP Set Exception Handler Summary: in this tutorial, you will learn how to set an exception handler using the PHP set_exception_handler() function. Introduction to the PHP set_exception_handler function In practice, it’s very difficult to catch every possible exception. If an exception is uncaught, you’ll see the exception message on the page. PHP allows you to…
Read more

PHP throw Exception

PHP throw Exception Summary: in this tutorial, you will learn about the Exception class in detail and how to throw a new exception in PHP. Introduction to the Exception class When encountering a situation from which you cannot recover, you can throw an exception. An exception is an instance of the Exception class. Like other…
Read more