我正在使用codeigniter并使用用户3图像进行工作查询。我想打一个算一个让每个图像的号码1,2,3,4,5,6,7 ......,并且想要查询输出在sql查询中制作计数器
-number (count),
-id,
-image,
-date
我的SQL查询:
function bar_images_first($user_id)
{
$sql = "SELECT id, image, UNIX_TIMESTAMP(date) as date FROM images WHERE user_id = 3 LIMIT 3";
$query = $this->db->query($sql, $user_id);
return $query->result_array();
}
是否有可能在查询中做计数器?
你是什么意思两个查询? – Viktors
@ViktorsGolubevs,他的意思是逐个运行每个查询,就像我最后一个例子。 – Starx
'@'是什么? –