mysql - execute this function everyday in php and codeigniter with Xampp -
i want execute function everyday. using xampp development , testing codeigniter framework uses php , mysql.
this code works fine populate database table current day want automatically an event not trigger
people told me use cron don't know how create files , put them since using windows hosting
function create_users_records(){ //get user's ids , number $this->db->select('id'); $query = $this->db->get('users'); $number_of_employees = $query->num_rows(); echo "number of employees is: ".$number_of_employees."<br>"; ($i = 0; $i < $number_of_employees; $i++) { $row = $query->row($i); echo $row->id ."<br>"; //date , time $time = time(); //date format $datestring = "%y-%m-%d"; $data = array( 'attendence_date_daily' => mdate($datestring, $time), 'check_in_time' => null, 'check_out_time' => null, 'attendence_status' => null, 'employee_comment' =>null, 'deducted_today' => 0, 'user_id' => $row->id ); $this->db->insert('daily_attendence_record', $data); } }
i creating attendance system , required create daily records users @ midnight can check in/out before time , record vacations , absences.
if you're using windows hosting set scheduled task on server rather using cron.
put above function controller somewhere , make can invoke via url. can use routing.php
in config
map http://example.com/update
function.
try out solution outlined here, should need schedule task.
Comments
Post a Comment