Sunday, 11 December 2016

Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classical literature, discovered the undoubtable source. Lorem Ipsum comes from sections 1.10.32 and 1.10.33 of "de Finibus Bonorum et Malorum" (The Extremes of Good and Evil) by Cicero, written in 45 BC. This book is a treatise on the theory of ethics, very popular during the Renaissance. The first line of Lorem Ipsum, "Lorem ipsum dolor sit amet..", comes from a line in section 1.10.32. The standard chunk of Lorem Ipsum used since the 1500s is reproduced below for those interested. Sections 1.10.32 and 1.10.33 from "de Finibus Bonorum et Malorum" by Cicero are also reproduced in their exact original form, accompanied by English versions from the 1914 translation by H. Rackham.

Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classical literature, discovered the undoubtable source. Lorem Ipsum comes from sections 1.10.32 and 1.10.33 of "de Finibus Bonorum et Malorum" (The Extremes of Good and Evil) by Cicero, written in 45 BC. This book is a treatise on the theory of ethics, very popular during the Renaissance. The first line of Lorem Ipsum, "Lorem ipsum dolor sit amet..", comes from a line in section 1.10.32.
The standard chunk of Lorem Ipsum used since the 1500s is reproduced below for those interested. Sections 1.10.32 and 1.10.33 from "de Finibus Bonorum et Malorum" by Cicero are also reproduced in their exact original form, accompanied by English versions from the 1914 translation by H. Rackham.

Friday, 3 October 2014

Drupal PHP Query Connection

$DB_NAME = DB_START_NAME . $clinic_id;
    dpr($DB_NAME);
    $database_info = array(
        'host' => HOST_NAME,
        'database' => $DB_NAME,
        'username' => HOSTUSER,
        'password' => HOSTPASS,
        'driver' => 'mysql',
    );

    Database::addConnectionInfo('flat_db', 'default', $database_info);
    $key = 'flat_db';
    $custom_db = Database::getConnection($DB_NAME, $key);
    $sql_query = "SELECT * FROM sc_patient_appointments LIMIT 1";  
    $result = $custom_db->query($sql_query);
       foreach ($result as $row) {
        //$reaged = (array) $row; // Standard object to array  
        dpr($row);
    }

Sunday, 31 August 2014

Php String Split to Array

$str = 'one,two,three,four';
$arr=explode(",",$str);
dpr($arr);

--------Result 

Array
(
    [0] => one
    [1] => two
    [2] => three
    [3] => four
)

Monday, 11 August 2014

drupal mysql insert statement

$id = db_insert('pms_link_master')
      ->fields(array(
          'NODE_ID' => '1',
          'PMS_ID' => '2',
          'CLINIC_ID' => '415',
          'MASTER_TYPE' => 'location'
  ))
  ->execute();

drupal custom mysql statement

 $sql_query = db_query("select * from pms_link_master");
  echo "total rows ".$sql_query->rowCount();

    $sql_array = array();
    foreach ($sql_query as $row) {
        $reaged = (array) $row; // Standard object to array    
        $sql_array[] = $reaged;
    }
dpr($sql_array);

Friday, 4 July 2014

PHP Read Folder Files



  $files = glob($dir . '*.csv');

foreach ($files as $x => $x_filepath) {
        // get file path
        $filePath = $x_filepath;
        // get file name
        $file_NAME = basename($filePath, ".csv");
}

PHP Read CSV file and store in array

function fun_readCSV($csvFile) {
    if (!file_exists($csvFile) || !is_readable($csvFile)) {
        fun_logMessage($messageID = '', $message = 'File Not Found', $mstType = 'Developer', $fieldName = '', $rowID = '');
        return FALSE;
    }
    $file_name = basename($csvFile);  // Show File Name
    echo ' File Size '.filesize($csvFile);
    $file_handle = fopen($csvFile, 'r');
    while (!feof($file_handle)) {
        $line_of_text[] = fgetcsv($file_handle, 1024);
    }
    fclose($file_handle);
    $line_of_text = array_unique($line_of_text, SORT_REGULAR);   
    print array2table($line_of_text);
    return $line_of_text;
}