mysql - input date and time into the database using php -



mysql - input date and time into the database using php -

i have android application through users login , logout @ same time date , time of login , logout should saved in database simultaneously. server script wrote is

[code] require_once('config.php'); //link database $adminid = $_request['adminid']; //no default $empid = $_request['empid']; //no default $dailyentry = $_request['dailyentry']; //no default $dailyexit = $_request['dailyexit']; //no default $lunchin = $_request['lunchin']; //no default $lunchout = $_request['lunchout']; //no default $workin = $_request['workin']; //no default $workout = $_request['workout']; //no default $date=date("y-m-d h:i:s"); if(mysql_query("insert dailyattendance adminid empid dailyentry dailyexit lunchin lunchout workin workout values('".$adminid."','".$empid."','".$dailyentry."','".$dailyexit."','".$lunchin."','".$lunchout."','".$workin."','".$workout."')"); $posts[0]['message'] = 'successful'; $idd = mysql_insert_id(); $selectt = mysql_query("select * dailyattendance id = '".$idd."'"); $results = mysql_fetch_assoc($selectt); $posts[0]['detail'] = $results; header('content-type: application/json'); echo json_encode($posts); ?> [/code]

the problem arises want total no of hours user works @ end of month don't know how it. appreciate if help me in coding of add-on portion of working hours.

you can below ,

<?php $totalhourofoffice = strtotime($dailyexit) - strtotime($dailyentry); $totalhourofoffice = $totalhourofoffice/3600; $totallunchhour = strtotime($lunchin) - strtotime($lunchout); $totallunchhour = $totallunchhour/3600; $totalhour = totalhourofoffice - totallunchhour; ?>

php mysql json database

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -