How to join tables in codeigniter

I this article we explain how to use joins in codeigniter active record query. using of codeigniter active record joins you can write complex join queries easily and also active record queries is safer and support all database because of codeigniter handle this automatically.

In codeigniter active record you can join multiple tables. here explain different type of join queries with example.

use join() method in active record for applying join on multiple tables, below show join() method parameters :

$this->db->join(TABLE_NAME, CONDITION, JOIN_TYPE); //JOIN_TYPE = left,inner,right and etc


Time Ago Function in PHP

I this article we will provide complete code with demo for convert given date time into timestamp using php and show time-ago format. we have create custom date_time_ago() function, in this function need 3 parameters first is your date time string, second one is date time format and third is time format.

$input_date – this is your date time string
$date_format – this is date time complete format, if time ago grater then 2 days then date show in this given format.
$time_format – this is time format when show time, like Yesterday at 6:45 PM


How to Send Push notification using FCM(Firebase Cloud Messaging) using php

Firebase Cloud Messaging(FCM) is a google cloud messaging service it is used for sending notification and messages in cross-platform for android, web application and ios application, which is available at no cost.

If you want to use this service in your application please just follow below simple steps and then you can send notification using google FCM(Firebase Cloud Messaging) service.

MySQL Database Table for store user device ids and store data in table


Detect AJAX Request in php

sometimes we are use single page for render html and response ajax request, so we need to detect ajax request or page render request.

In this article i would like to explain how to detect ajax request in Core PHP, Codeigniter and Zend framework and process your code.

Detect Ajax Request In Core PHP

This below code catch ajax request and provide event, so you can process your ajax operations.


How to Connect Multiple Database in Codeigniter

If you want to connect multiple database in single application with codeigniter, just follow below simple steps and setup configuration.

Set multiple database details in database.php file

You should provide all the database details in “application/config/database.php” file with defferent groups, like below examples.

Generally, you have to set default database group, like below code :