어떻게 할 수 있습니다 columns
row (database)
에 의해 codeigniter
?
다음 코드는 true
입니까?어떻게 행 (데이터베이스)의 모든 열을?
$this->db->get('mytable')->where('*', $id);
어떻게 할 수 있습니다 columns
row (database)
에 의해 codeigniter
?
다음 코드는 true
입니까?어떻게 행 (데이터베이스)의 모든 열을?
$this->db->get('mytable')->where('*', $id);
첫 번째로 일치하는 행을 가져 오려고한다고 가정합니다. 원하지 않으면 다시 설명해주십시오.
시도 뭔가 같은 :
$query = $this->db->
select('title')->
from('mytable')->
where('*', $id)->
limit(1)-> //Only want 1 row
get(); //Get result
if ($query->num_rows() == 0)
show_error('No rows to return'); //Exits, nothing after this will run
$row = $query->row(); //Gives you the first row, you can
$result = $this->db->get_where(<table_name>, array(<field_name> => <check_value>));
을 사용하는 것이 좋습니다 것입니다
, 당신이 요구하는 코드가 될 것
$result = $this->db->get_where('mytable', array('*' => $id));
그러나 당신이 요구하는 코드가 다음과 같이 작동하는지 확신 할 수 없다 : |
이 코드
$this->db->where('id', $id);
$result = $this->db->get('mytable);
와 함께 단일 행의 모든 열을 얻을 수 있습니다 또는 단순히 당신이
$result = $this->db->get_where('mytable', array('id' => $id), $limit, $offset);
$ 필드 = $ this-> DB-> list_fields ('TABLE_NAME'을 시도 할 수 있습니다); ? –