2017-03-19 53 views
0

這是我的截圖的問題,我有

This my screenshot problem I have

我有我的看法如下代碼。

$jumlah = $this->db->query(" 
      SELECT * FROM actor 
      JOIN film_actor ON film_actor.actor_id=actor.actor_id 
      JOIN film ON film.film_id=film_actor.film_id 
      JOIN film_category ON film_category.film_id=film.film_id 
      JOIN category ON category.category_id=film_category.category_id 
      WHERE first_name like $u->first_name AND last_name like $u->last_name"); 
      ?> 

爲什麼我的查詢不起作用?我想我已經完成了該代碼,但爲什麼我收到錯誤消息。

對不起,我無法描述我的問題,所以細節,但我有形象來描述。

+0

在單引號中給出'$ u-> first_name'等值。 –

回答

0
$array = array('first_name' => $u->first_name, 'last_name' => $u->last_name); 
$jumlah = $this->db->select('*')->from('actor'); 
     $this->db->join('film_actor', 'film_actor.actor_id=actor.actor_id'); 
     $this->db->join('film', 'film.film_id=film_actor.film_id'); 
     $this->db->join('film_category', 'film_category.film_id=film.film_id'); 
     $this->db->join('category', 'category.category_id=film_category.category_id '); 
     $this->db->like($array); // WHERE `first_name` LIKE '%$u->first_name%' AND `last_name` LIKE '%$u->last_name%'