Blogz

Recent Blogz

Drupal 8 : How to use INSERT query with Syntax and Example

Insert is the Data Manipulation Language(DML) query in Database management system. Using the object of core Drupal class we can perform database queries in Drupal 8. Insert is the data saving query used to store data to Database. The insert() is a function of Drupal 8 core class used for insert records. Below is syntax and example of how to use INSERT query in Drupal 8.

Before Insert Table be like:

EMPLOYEE_ID EMPLOYEE_NAME EMPLOYEE_AGE
CE 001 Mohan 20
CE 002 Dinesh 17

 

After Performing Insert Query table records like:

Related Posts:

Drupal 7 : Accessing User Profile fields and changing programmatically with example

In Drupal 7 Profile2 module help to create user profiles. The Profile2 module handle each profiles as separate entity with set of Drupal fields. Similar to changing user account we can change profile values. Below example show how to access profile values and updating profile values.

Drupal 7 : Select list options by Taxonomy term depth(Parent Child) with source code

In Drupal by Taxonomy term list are arranged as parent child format. Similarly we can able to create List option in our custom form. Below is the source code to generate option array as Parent child hierarchy. List key is Term ID and display name is Taxonomy term hierarchy.

Drupal 7 : Creating custom hook for user defined functions with sample code

In Drupal HOOK are used to alter values or construct values to program. It similar to implementing class in Object Oriented Concepts. In Core and Contributed modules create their HOOK functions for extending functionality. In custom module we can able to create our custom HOOK to alter data from other modules.This is achieved by using the function drupal_alter().

Angular directive to check the scroll position of an element with Example and Demo

Angular Directives are markers on a DOM element which attach a special behavior to it. Here in this example the directive "onScroll" listens to a scroll event. The scroll position from the element is found using scrollTop.

MySQL : Importing Database Dump / Backup to MySQL Server

We can able to make dump of MySQL database as .sql file[Refer: MySQL : Backup / Dump MySQL Database in Windows and Ubuntu]. By using the dump of sql file we can import them to MySQL database using the mysql command "use FILE_NAME.sql". This will import entire database source file into database schemas and dataset to schemas. Import time is based on Dump size.

Drupal 7 : Programmatically adding Fields in View with Example

By Default Drupal Views show the fields that are configured in UI. Based on our requirements we can able to add custom fields to view on rendering. This feature is achieved by using the HOOK hook_views_pre_view(). Using the object of $view we can call function “add_item()” this will add the fields to the View.