Category: mysql

PHP Mysql DELETE Query

If you want to delete a record from any MySQL table, then you can use the SQL command DELETE FROM. To understand Delete query, consider an Customers table, which is having following query First you can need database connection in php Code

Grouping Query in Codeigniter

Query grouping allows you to create groups of WHERE clauses by enclosing them in parentheses. This will allow you to create queries with complex WHERE clauses. Nested groups are supported. $this->db->group_start() Starts a new group by adding an opening parenthesis to the WHERE clause of the query. $this->db->or_group_start() Starts a new group by adding an […]

Prepared Statements in PDO – MySQL

A prepared statement (also known as parameterized statement) is simply a SQL query template containing placeholder instead of the actual parameter values. Here is example of PDO statements. <?php $servername = “localhost”; $username = “root”; $password = “”; $dbname = “myDBPDO”; try {     $conn = new PDO(“mysql:host=$servername;dbname=$dbname”, $username, $password);     // set the PDO error mode to exception     $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);     // […]

Increment & Decrement in Laravel 5

If you want to increment or decrement opration using update() method of laravel query builder then you also do that, i am showing you how to increment and decrement value of column in table by using increment(), and decrement(). Both of these methods accept at least one argument the column to modify. A second argument […]