Skip to main content

Posts

Showing posts from October, 2015

How to Write Drupal Dynamic query with datbase SCHEMA in Postgres

<?php   $tbl = 'secc_rural';//schema name   $house_hold_id = '123456';   $query = db_select($tbl.".individual_21", "n");   $query->fields('n',array('name','ahl_tin','ahl_tin','fathername','name_sl','mothername','occupation','yob','hof','genderid','relation','house_hold_id'));     $query->condition('n.house_hold_id',db_like($house_hold_id) . '%', 'LIKE');   $query = $query->extend('TableSort')->extend('PagerDefault')->limit(20);   $result = $query->execute();

taxonomy in drupal custom form

To add taxonomy in drupal custom form. By using taxonomy_form() we can form a texonomy in form. For Ex: $vid=4; $category1 = taxonomy_form($vid, $value = 0, $help = NULL, $name = 'taxonomy'); $form['taxonomy_info']['taxonomy1'] = array( '#type' => 'select', '#title' => t('Terms for the Website'), '#options' => $category1, '#description' => t('Website category'), );

mamchache drupal

Following steps are allowed to install memcache in drupal  7 1.Install the memcached binaries on your server. See How to install Memcache on Debian Etch[ http://www.lullabot.com/articles/how_install_memcache_debian_etch  ] or How to install Memcache on OSX [ http://www.lullabot.com/articles/setup-memcached-mamp-sandbox-environmen...  ] 2.Install the PECL memcache extension for PHP. 3. In settings.php add ini_set('memcache.hash_strategy','consistent');4. Put your site into offline mode.5. Download and install the memcache module [  http://drupal.org/project/memcache  ]6. If you have previously been running the memcache module, run update.php.7. Apply the DRUPAL-5-cache-serialize.patch that comes with memcache module [memcache/patches]I applied DRUPAL-5-3-cache-serialize.patch hence I am using drupal 5.38. Start at least one instance of memcache on the server.[ex ./memcached -d -m 2048 -l 10.0.0.40 -p 11211 ]Here 11211 is an instance of memcache, 10....

How to implement Verhoeff’s algorithms In PHP with Postgres

Create new function in postgres db , like, calculateVerhoeff() returns an integer single digit which is the checksum to be used -- verifyVerhoeff() returns a boolean, true for number is valid, false for invalid CREATE OR REPLACE FUNCTION checksumVerhoeff ( num numeric , calcChecksum boolean ) RETURNS integer LANGUAGE plpgsql AS $$ DECLARE d CHAR ( 100 ) : = '0123456789123406789523401789563401289567401239567859876043216598710432765982104387659321049876543210' ; p CHAR ( 80 ) : = '01234567891576283094580379614289160435279453126870428657390127938064157046913258' ; inv CHAR ( 10 ) : = '0432156789' ; c integer : = 0 ; len integer ; m integer ; i integer : = 0 ; n VARCHAR ( 255 ); BEGIN /* Start Processing */ n : = REVERSE ( num :: varchar ); len : = LENGTH ( n ); WHILE ( i < len ) LOOP IF ca...