Codeigniter Email

Step 1
php.ini>uncomment opsenssl

Step 2
In email controller,
function email(){
$config[‘protocol’] = ‘smtp’;
$config[‘smtp_host’] = ‘ssl://’;
$config[‘smtp_port’] = 465;
$config[‘smtp_user’] = ‘’;
$config[‘smtp_pass’] = ‘chochowintintun’;
$this->load->library(’email’, $config);
$this->email->from(‘’, ‘Su Myat’);
$this->email->subject(‘This is an email test’);
$this->email->message(‘It is working. Great!’);
echo ‘Your email was sent, successfully.’;



Turn on Remote Desktop

Step one

Step two

Step three

Step four
Search Remote Desktop Connection in window search box

Step five

Note: The computer which used as remote computer will logoff when the other computer start access to that computer.
Then, enjoy it!

Setup cron job on local server

Go to Startmenu->All Programs->Accessories->System Tools->Task Scheduler->create Task

In the new window we having 4 options

1. General (Give the Task name and for testing you can select “Run when User is logged in“)

2. Trigger (You can Select the running interval as “daily,weekly,monthly”. )

3. Action (This is most important part.Select a Mozilla firefox as the “program/script” and in the Argument provide the URL to fire with Mozilla firefox like

To DO:
Create a task give Running time in Trigger setting.Then in Action setting option in the “Program/Script” command textbox type
and in the “Add arguments (optional)” type
-f c:/xampp/htdocs/mycron.php

How to sort ID due to where clause used with IN(..)

FROM `question`
WHERE `id`
IN ( 9, 11, 175, 16 )

The results will be displayed where ids are 9, 11, 175, 16, but the results will be asc by id(9,11,16,175). If you don’t want to use automatic sorting or just list according to 9,11,175,16 add ORDER BY FIELD.

FROM `question`
WHERE `id`
IN ( 9, 11, 175, 16 )
ORDER BY FIELD( id, 9, 11, 175, 16)

Using curl for codeigniter REST

1. copy curl file to library file
2. There would be two controller in ci. One for sending data in JSON format and one for receiving data in JSON format by json_decode.
To insert data into MySQL db from data from android,
In one controller(eg. client_test controller),
function client_register()
$username = ‘admin’;
$password = ‘1234’;



// Optional, delete this line if your API is open
$this->curl->http_login($username, $password);

$data = array (
“type_id” => 1,
“agent_id” => 2,
“first_name” => “Joanna”,
“last_name” => “Lee”,
“phone” => “234555”,
“address” => “Mandalay”,
“city” => “Mandalay”,
“mobile” => “095053453”,
“email” => “”,
“createddate” => “2013-10-04”,
“modifieddate” => “2013-10-0”

$json = json_encode($data);
‘postdata’ => $json
$result = json_decode($this->curl->execute());
In the other controller(client controller) that might extends REST_Controller(,
function create_post()
$json = $this->post(‘postdata’);
$data = json_decode($json);
$this->db->insert(‘client’, $data);
$message = json_encode(array(“last_insert_id” => $this->db->insert_id()));
$this->response($message, 200);
catch (Exception $e)
$this->response(array(‘error’ => $e->getMessage()), 500);
Then, in the url type client_register, then if it is successfully inserted it will display last insert id.