Search
 
SCRIPT & CODE EXAMPLE
 

PHP

how to write orderby in join query with where clause in codeigniter

public function getLatestStatus($data, $userid)
	{
		$this->db->select('
				S.shipment_id,
				S.added_on,
				S.waybill_number AS waybill,
				s_status_logs.updated_on,
				s_status_logs.status_location,
				s_status_logs.px_statuscode,
				s_status.status_title,
				s_status_logs.status_description AS remark,
				transitpartner_name
			');
		$this->db->from('shipments as S');
		$this->db->join('users', 'users.user_id=S.user_id', 'left');
		$this->db->join('master_transit_partners as mtp', 'mtp.transitpartner_id=S.fulfilled_by', 'left');
		$this->db->join('shipments_status_logs as s_status_logs', 's_status_logs.shipment_id=S.shipment_id', 'left');
		$this->db->join('shipments_status as s_status', 's_status.status_id=s_status_logs.px_statuscode', 'left');
		$this->db->where('S.waybill_number', $data);
		$this->db->or_where('S.shipment_id', $data);
		$this->db->where('S.user_id', $userid);
		$this->db->limit(1, 1);
    $this->db->order_by('S.shipment_id', 'desc');
		$query = $this->db->get();
		return $query->result_array();
	}
Comment

PREVIOUS NEXT
Code Example
Php :: add a controller method in laravel routes 
Php :: i+= in php 
Php :: parsing html in php 
Php :: php exec get pid 
Php :: curl error (code 3) url malformed laravel 
Php :: laravel collection namespace 
Php :: how to make a loop that adds numbers to a variable in php 
Php :: wordpress autosave 
Php :: class php 
Php :: substract two datetime and get the different hours and minutes php 
Php :: contact form 7 get form id 
Php :: protected gaurded in laravel 
Php :: php laravel dump 
Php :: laravel vendor/laravel/framework/src/Illuminate/View/Compilers/Compiler.php:36 
Php :: get taxonomy name in taxonomy page wordpress dev 
Php :: laravel intersect 
Php :: how to include javascript in php 
Php :: laravel on cascade set null 
Php :: calculate array length in php 
Php :: cmd disable wifi driver 
Php :: laravel model uploaded file name 
Php :: fgets in php 
Php :: php search multidimensional array for multiple values 
Php :: php object to string 
Php :: php if time is greater than 
Php :: replace twig 
Php :: How to Customize WooCommerce Breadcrumb 
Php :: acf looping through post types 
Php :: how to search like in php 
Php :: php generate unique id for word 
ADD CONTENT
Topic
Content
Source link
Name
4+5 =