⇧
vadnica-logo
My Services About the Project Telegram O meni O meni

Creating a Database (CREATE DATABASE)

To execute SQL commands that do not return a result set (such as CREATE DATABASE), we use the exec() method in PDO. This method executes the command and returns the number of rows affected.

EXAMPLE
RESULT
The result will be displayed here...

When creating a database, we first connect to the server (without specifying the database name in the DSN string), and then we execute the command. We wrap the entire process in a try...catch block to catch any access errors.