Quantcast
Channel: PHP Freaks: PHP Help
Viewing all articles
Browse latest Browse all 13200

Codeigniter Active Record

$
0
0

This is my code

$this->db->select("b.id, p.name, CONCAT_WS(' ', u.first_name, u.last_name ) AS full_name, DATE_FORMAT(b.check_in, '%d %b %Y') AS ck_in, DATE_FORMAT(b.check_out, '%d, %b %Y') AS ck_out, b.canceled, DATE_FORMAT(b.booked_on, '%d, %b %Y') AS booked_on");
						   
		$this->db->from('bookings b');
		$this->db->join('pubs p', 'b.pub_id = p.id');
		$this->db->join('users u', 'b.customer_id = u.id');
		$this->db->where('b.user_id', $user_id);
		
		return $this->db->get()->result_array();

when i run i get

Error Number: 1064

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '%d`, `%b` %Y') AS ck_out, `b`.`canceled`, DATE_FORMAT(b.booked_on, `'%d`, `%b` %' at line 1

SELECT `b`.`id`, `p`.`name`, CONCAT_WS(' ', `u`.`first_name`, `u`.`last_name` ) AS full_name, DATE_FORMAT(b.check_in, `'%d` %b %Y') AS ck_in, DATE_FORMAT(b.check_out, `'%d`, `%b` %Y') AS ck_out, `b`.`canceled`, DATE_FORMAT(b.booked_on, `'%d`, `%b` %Y') AS booked_on FROM (`bookings` b) JOIN `pubs` p ON `b`.`pub_id` = `p`.`id` JOIN `users` u ON `b`.`customer_id` = `u`.`id` WHERE `b`.`user_id` = '3'

Viewing all articles
Browse latest Browse all 13200

Trending Articles