次のように、データベースに visits という名前のテーブルがあります。
id ip action_date|time_stamp
このコードを使用して、サイトへのアクセスを保存します
/* Hits table has an auto-incrementing id and an ip field */
// Grab client IP
$ip = $this->input->ip_address();
// Check for previous visits
$query = $this->db->get_where('visits', array('ip' => $ip), 1, 0);
$query = $query->row_array();
if (count($query) < 1 )
{
// Never visited - add
$this->db->insert('visits', array('ip' => $ip) );
}
それはうまくいっています。しかし、私のクライアントは、月に何回訪問したかを知る必要があります。どうやってやるの ?タンク。