How-to articles, tricks, and solutions about DATABASE

Doctrine 2: Update query with query builder

To update an entry in a database using Doctrine's query builder, you can use the update method of the QueryBuilder class.

How do I find out my MySQL URL, host, port and username?

To find out your MySQL connection details, you will need to look in your MySQL configuration files. The specific location of these files will depend on how you installed MySQL, but common locations include /etc/my.cnf,

How to Check if a Record Exists in a MySQL Database

In this tutorial, we are going to represent to you two handy options of how to check if a record exists in the database with PHP.

How to create a foreign key in phpmyadmin

To create a foreign key in PHPMyAdmin, follow these steps:

How to store file name in database, with other info while uploading image to server using PHP?

To store the file name in a database along with other information while uploading an image to a server using PHP, you can follow these steps:

Laravel 5 getting ID from URL

In Laravel 5, you can get the ID from the URL by using the $request object or by defining a route parameter in the web.php file.

Laravel: Error [PDOException]: Could not Find Driver in PostgreSQL

It looks like you are trying to connect to a PostgreSQL database from your Laravel application, but the PDO (PHP Data Objects) extension is not installed or enabled in your PHP environment.

Laravel: How to get last N entries from DB

You can use the latest method on a query builder instance to get the last N entries from the database.

PDO get the last ID inserted

To get the last inserted ID using PDO, you can use the PDO::lastInsertId() method after inserting a row into the database.

PHPExcel and Text Wrapping

PHPExcel is a library for working with Microsoft Excel files in PHP.

Proper Repository Pattern Design in PHP?

The Repository pattern in PHP is a design pattern that allows for the separation of the business logic of an application from the storage and retrieval of data.