What is 401 and 403 error code, How 401 and 403 are different

403 Forbidden vs 401 Unauthorized HTTP responses There's a problem with 401 Unauthorized, the HTTP status code for authentication errors. And that’s just it: it’s for authentication, not authorization. Receiving a 401 response is the server telling you, “you aren’t authenticated–either not authenticated at all or authenticated incorrectly–but please reauthenticate and try again.” To help... Continue Reading →

Advertisements

UNDERSTANDING THE CONCEPT OF VISIBILITY IN OBJECT ORIENTED PHP

The Three Visibility Levels In OOP PHP we have three visibility levels for properties and methods of a class: public, protected, and private. Visibility is declared using a visibility keyword to declare what level of visibility a property or method has. The three levels define whether a property or method can be accessed outside of... Continue Reading →

Dependent multiple selection drop down in drupal form

Suppose you want to alter "policy_node_form", then you need to do coding as below. function page_form_alter(&$form, &$form_state, $form_id) { if ($form_id == 'policy_node_form') { $form['field_department']['und']['#ajax'] = array( 'wrapper' => 'policy_category_list', 'callback' => 'ajax_policy_category_callback', 'method' => 'replace', ); $form['field_policy_categories']['#validated'] = TRUE; $form['field_file_upload']['#validated'] = TRUE; $form['field_policy_categories']['und']['#options'] = categories_options($form_state); $form['field_policy_categories']['#prefix'] = ''; $form['field_policy_categories']['#suffix'] = ''; $form['#validate'][] = 'form_validate_policy_add';... Continue Reading →

drupal select query in details

A Select query will always return a result set object of zero or more records. There are several ways to then retrieve data from that result set, depending on the use case. The most common case is to iterate over the result set with a foreach() loop. $result = db_query("SELECT nid, title FROM {node}"); foreach... Continue Reading →

Solution of Class ‘MongoClient’ not found in php

You have not installed MongoDB PHP driver please see this link http://www.php.net/manual/en/mongo.installation.php Update sources sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10 echo 'deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen' | sudo tee /etc/apt/sources.list.d/mongodb.list sudo apt-get update Install MongoDB PHP Driver sudo apt-get install php5-dev php5-cli php-pear -y sudo pecl install mongo Open your php.ini file and add to... Continue Reading →

How to Install and Configure MongoDB on Ubuntu 16.04

Reference: https://www.howtoforge.com/tutorial/install-mongodb-on-ubuntu-16.04/ What we will do in this tutorial: Install MongoDB Configure MongoDB Conclusion Install MongoDB on Ubuntu 16.04 Step 1 - Importing the Public Key GPG keys of the software distributor are required by the Ubuntu package manager apt (Advanced Package Tool) to ensure package consistency and authenticity. Run this command to import MongoDB... Continue Reading →

Inser record from db_query

From below query you can insert using db_query db_query('INSERT INTO {itg_menu_manager} (title,url,target,menu_level,menu_name,url_type,section_id,weight) VALUES (:values,:url,:target,:menu_level,:menu_name,:url_type,:section_id,:weight)', array(':values' => "ramji" ,":url" => 'asd', ':target' => 'asd' ,':menu_level' => 'menu_level' , ':menu_name' => 'asd',':url_type' => 'asd',':section_id' => 'asd', ':weight' => 12));

WordPress.com.

Up ↑