0
table name : mytable
id name salt value
1 a 10 39
2 a 20 13
3 a 10 14
4 b 40 39
mymodel.phpCodeigniter:检索表中的最新行?
function get_value_by_name($name)
{
$this->db->select("*");
$this->db->from("mytable");
$this->db->where('salt', '10');
$this->db->where('name', $name);
$this->db->order_by('id',"ASC");
$this->db->limit(1);
$query=$this->db->get();
if($query != null){
return $query->result();
}
else{
return array();
}
}
我想获得最新的行与name = a和盐= 10(使用id = 3行)。但是我现在的代码返回第一行。
你知道上升相反?取其前四个字符并按顺序使用它 – Gervs 2014-09-28 14:24:10