Sunday, August 25, 2013

Change LAMP Server IP Address

For ubuntu 13.4

File to change ::

1.  /etc/hosts
2. /etc/mysql/my.cnf
    bind-address            = 131.107.2.222

3. restart apache2
    service apache2 restart


Wednesday, August 14, 2013

Best Hosting

Best Hosting

1. Exabytes - Malaysia best hosting

2. Ipage - Cheap & best value for Money Hosting

3.

php cli

PHP CLI 
 
checking PHP version 
 
php --version
find / -name "php53" -print

Tuesday, August 13, 2013

Date

Format : date(format,timestamp)

$today = date("Y-m-d");

format time stamp : mktime(hour,minute,second,month,day,year,is_dst)

$tomorrow = mktime(0,0,0,date("m"),date("d")+1,date("Y"));

$nextweek = date("Y-m-d",mktime(0,0,0,date("m"),date("d")+7,date("Y")));

Monday, August 12, 2013

PHP : load combo (static option)

/*
FUNCTION FUNCTION load_visit_type($field_name,$form_name,$curr_item,$add_blank=false,$auto_submit=false,$readonly='',$disabled='') {


   $a_code = array();
   $a_desc = array();

   $a_code[]="1";
   $a_code[]="2";
   $a_code[]="3";
   $a_code[]="4";

   $a_desc[]="Initial Home Assessment";
   $a_desc[]="Follow up Home Assessment";
   $a_desc[]="Routine Home Visist Assessment";
   $a_desc[]="Emergency";

   $opt="";
   if ($auto_submit==true) {
       $opt="<select name='$field_name' onchange='document.".$form_name. ".submit();'>" ;
   } else {
       $opt="<select name='$field_name' ".$readonly." " .$disabled.">" ;
   }   if ($add_blank==true) {
      $opt .= "<option value=''";
      if ( $curr_item == '' ) {
         $opt .= ' selected="selected" ';
      }
      $opt .= ' ></option>' ;
   }

  $no_of_element=count($a_code);

  for ($i = 0; $i < $no_of_element; $i++) {
     $opt .= "<option value='" . $a_code[$i] ."'";
     if ( trim($curr_item) == $a_code[$i] ) {
         $opt .= ' selected="selected"';
     }
     $opt .= ">". $a_desc[$i]. "</option>";
  }
  $opt .="</select>";             

  return $opt;
}



$add_blank=true;
$auto_submit=false;

call by :

$this->load_visit_type("visit_type","form1",$this->visit_type,$add_blank,$auto_submit)

$vtype = $this->load_visit_type("visit_type","form1",$db->record['visit_type'],true,false,'readonly','disabled');


*/