Jump to content

ramiwahdan

Members
  • Posts

    114
  • Joined

  • Last visited

Posts posted by ramiwahdan

  1. Hi,

    I have select statement that has where clause with 3 conditions out of which 2 conditions i need to take values from form in the page.

    code:

    $res = $conn->query("SELECT oracleid
                             , name 
                             , des 
                             , clockingindate
                             , clockingoutdate  
                             , timediff(clockingoutdate, clockingindate) as duration
                             , total
                        FROM attendance_records
                             JOIN (
                                    SELECT oracleid
                                         , sec_to_time(sum(timestampdiff(SECOND, clockingindate, clockingoutdate))) as total
                                    FROM attendance_records
    								where isdone =-1 
                                    GROUP BY oracleid
                                  ) tots USING (oracleid)
    							  where isdone =-1 and DATE(ClockingOutDate) >= $sdate1 and DATE(ClockingOutDate) <= $edate1
                        ORDER BY oracleid, clockingindate
                        ");

    and the form fields names are assigned to variables sdate1 and edate1

    code:
     

    	<Center>
    	
    	<h2>Please enter start date and end date:</h2>
    	
    	</center>
    	<form action="#" method="post">
    	
    	<center>
    	<h5>Start Date:<input type="date" name="sdate" placeholder = "Start Date" required="required"></input>
    	End Date:<input type="date" name="edate" placeholder = "End Date" required="required"></input>
    	<input type="submit" name="saveit" value="Generate"></input></h5>
    	</center>
    	
    	</form>
    
    	<div class="container">
    		<div class="row">
    			<div class="col m-auto">
    				<div class="card mt-5">
    					<table class="table table-bordered">
    					
    						<tr>
    
    							<input type="button" onClick="window.print()" value="Print The Report"/>
    							<td>OracleID</td>
    							<td>Name</td>
    							<td>Designation</td>
    							<td>Clocking In Time</td>
    							<td>Clocking Out Time</td>
    							<td>Duration</td>
    						
    						</tr>
    						
    <?php
    
    
    	if (isset($_POST['saveit']))
    								
    	{
    
    		$sdate1 = $_POST['sdate'];
    		$edate1 = $_POST['edate'];

    I tried to run the code didn't work but i take off the 2nd and 3rd conditions of where clause, it works.

  2. When I open XAMPP and click start MySQL button and it gives me an error. I had started it just before, but now it isn't working:

    12:19:12 PM [mysql] Attempting to start MySQL app...
    12:19:12 PM [mysql] Status change detected: running
    12:19:13 PM [mysql] Status change detected: stopped
    12:19:13 PM [mysql] Error: MySQL shutdown unexpectedly.
    12:19:13 PM [mysql] This may be due to a blocked port, missing dependencies,
    12:19:13 PM [mysql] improper privileges, a crash, or a shutdown by another method
    12:19:13 PM [mysql] Press the Logs button to view error logs and check
    12:19:13 PM [mysql] the Windows Event Viewer for more clues
    12:19:13 PM [mysql] If you need more help, copy and post this
    12:19:13 PM [mysql] entire log window on the forums
    
    Here is the contents of the error log:
    
    error log:
    
    InnoDB: using atomic writes.
    2020-03-17  2:25:06 0 [Note] InnoDB: Mutexes and rw_locks use Windows interlocked functions
    2020-03-17  2:25:06 0 [Note] InnoDB: Uses event mutexes
    2020-03-17  2:25:06 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
    2020-03-17  2:25:06 0 [Note] InnoDB: Number of pools: 1
    2020-03-17  2:25:06 0 [Note] InnoDB: Using SSE2 crc32 instructions
    2020-03-17  2:25:06 0 [Note] InnoDB: Initializing buffer pool, total size = 16M, instances = 1, chunk size = 16M
    2020-03-17  2:25:06 0 [Note] InnoDB: Completed initialization of buffer pool
    2020-03-17  2:25:06 0 [Note] InnoDB: Starting crash recovery from checkpoint LSN=1442641
    2020-03-17  2:25:06 0 [Note] InnoDB: 128 out of 128 rollback segments are active.
    2020-03-17  2:25:06 0 [Note] InnoDB: Removed temporary tablespace data file: "ibtmp1"
    2020-03-17  2:25:06 0 [Note] InnoDB: Creating shared tablespace for temporary tables
    2020-03-17  2:25:06 0 [Note] InnoDB: Setting file 'E:\xampp\mysql\data\ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
    2020-03-17  2:25:06 0 [Note] InnoDB: File 'E:\xampp\mysql\data\ibtmp1' size is now 12 MB.
    2020-03-17  2:25:06 0 [Note] InnoDB: Waiting for purge to start
    2020-03-17  2:25:07 0 [Note] InnoDB: 10.4.11 started; log sequence number 1442650; transaction id 5151
    2020-03-17  2:25:07 0 [Note] InnoDB: Loading buffer pool(s) from E:\xampp\mysql\data\ib_buffer_pool
    2020-03-17  2:25:07 0 [Note] Plugin 'FEEDBACK' is disabled.
    2020-03-17  2:25:07 0 [Note] InnoDB: Buffer pool(s) load completed at 200317  2:25:07
    2020-03-17  2:25:07 0 [Note] Server socket created on IP: '::'.
    InnoDB: using atomic writes.
    2020-03-17 11:30:50 0 [Note] InnoDB: Mutexes and rw_locks use Windows interlocked functions
    2020-03-17 11:30:50 0 [Note] InnoDB: Uses event mutexes
    2020-03-17 11:30:50 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
    2020-03-17 11:30:50 0 [Note] InnoDB: Number of pools: 1
    2020-03-17 11:30:50 0 [Note] InnoDB: Using SSE2 crc32 instructions
    2020-03-17 11:30:50 0 [Note] InnoDB: Initializing buffer pool, total size = 16M, instances = 1, chunk size = 16M
    2020-03-17 11:30:50 0 [Note] InnoDB: Completed initialization of buffer pool
    2020-03-17 11:30:51 0 [Note] InnoDB: Starting crash recovery from checkpoint LSN=1442659
    2020-03-17 11:30:51 0 [Note] InnoDB: 128 out of 128 rollback segments are active.
    2020-03-17 11:30:51 0 [Note] InnoDB: Removed temporary tablespace data file: "ibtmp1"
    2020-03-17 11:30:51 0 [Note] InnoDB: Creating shared tablespace for temporary tables
    2020-03-17 11:30:51 0 [Note] InnoDB: Setting file 'E:\xampp\mysql\data\ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
    2020-03-17 11:30:51 0 [Note] InnoDB: File 'E:\xampp\mysql\data\ibtmp1' size is now 12 MB.
    2020-03-17 11:30:51 0 [Note] InnoDB: Waiting for purge to start
    2020-03-17 11:30:51 0 [Note] InnoDB: 10.4.11 started; log sequence number 1442668; transaction id 5151
    2020-03-17 11:30:51 0 [Note] InnoDB: Loading buffer pool(s) from E:\xampp\mysql\data\ib_buffer_pool
    2020-03-17 11:30:51 0 [Note] Plugin 'FEEDBACK' is disabled.
    2020-03-17 11:30:51 0 [Note] InnoDB: Buffer pool(s) load completed at 200317 11:30:51
    2020-03-17 11:30:51 0 [Note] Server socket created on IP: '::'.
    InnoDB: using atomic writes.
    2020-03-17 11:34:35 0 [Note] InnoDB: Mutexes and rw_locks use Windows interlocked functions
    2020-03-17 11:34:35 0 [Note] InnoDB: Uses event mutexes
    2020-03-17 11:34:35 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
    2020-03-17 11:34:35 0 [Note] InnoDB: Number of pools: 1
    2020-03-17 11:34:35 0 [Note] InnoDB: Using SSE2 crc32 instructions
    2020-03-17 11:34:35 0 [Note] InnoDB: Initializing buffer pool, total size = 16M, instances = 1, chunk size = 16M
    2020-03-17 11:34:35 0 [Note] InnoDB: Completed initialization of buffer pool
    2020-03-17 11:34:35 0 [Note] InnoDB: 128 out of 128 rollback segments are active.
    2020-03-17 11:34:35 0 [Note] InnoDB: Creating shared tablespace for temporary tables
    2020-03-17 11:34:35 0 [Note] InnoDB: Setting file 'E:\xampp\mysql\data\ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
    2020-03-17 11:34:35 0 [Note] InnoDB: File 'E:\xampp\mysql\data\ibtmp1' size is now 12 MB.
    2020-03-17 11:34:35 0 [Note] InnoDB: Waiting for purge to start
    2020-03-17 11:34:35 0 [Note] InnoDB: 10.4.11 started; log sequence number 1442677; transaction id 5151
    2020-03-17 11:34:35 0 [Note] InnoDB: Loading buffer pool(s) from E:\xampp\mysql\data\ib_buffer_pool
    2020-03-17 11:34:35 0 [Note] Plugin 'FEEDBACK' is disabled.
    2020-03-17 11:34:35 0 [Note] Server socket created on IP: '::'.
    2020-03-17 11:34:35 0 [Note] InnoDB: Buffer pool(s) load completed at 200317 11:34:35
    InnoDB: using atomic writes.
    2020-03-17 11:34:41 0 [Note] InnoDB: Mutexes and rw_locks use Windows interlocked functions
    2020-03-17 11:34:41 0 [Note] InnoDB: Uses event mutexes
    2020-03-17 11:34:41 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
    2020-03-17 11:34:41 0 [Note] InnoDB: Number of pools: 1
    2020-03-17 11:34:41 0 [Note] InnoDB: Using SSE2 crc32 instructions
    2020-03-17 11:34:41 0 [Note] InnoDB: Initializing buffer pool, total size = 16M, instances = 1, chunk size = 16M
    2020-03-17 11:34:41 0 [Note] InnoDB: Completed initialization of buffer pool
    2020-03-17 11:34:41 0 [Note] InnoDB: 128 out of 128 rollback segments are active.
    2020-03-17 11:34:41 0 [Note] InnoDB: Creating shared tablespace for temporary tables
    2020-03-17 11:34:41 0 [Note] InnoDB: Setting file 'E:\xampp\mysql\data\ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
    2020-03-17 11:34:41 0 [Note] InnoDB: File 'E:\xampp\mysql\data\ibtmp1' size is now 12 MB.
    2020-03-17 11:34:41 0 [Note] InnoDB: Waiting for purge to start
    2020-03-17 11:34:41 0 [Note] InnoDB: 10.4.11 started; log sequence number 1442686; transaction id 5151
    2020-03-17 11:34:41 0 [Note] InnoDB: Loading buffer pool(s) from E:\xampp\mysql\data\ib_buffer_pool
    2020-03-17 11:34:41 0 [Note] Plugin 'FEEDBACK' is disabled.
    2020-03-17 11:34:41 0 [Note] Server socket created on IP: '::'.
    2020-03-17 11:34:41 0 [Note] InnoDB: Buffer pool(s) load completed at 200317 11:34:41
    InnoDB: using atomic writes.
    2020-03-17 11:34:59 0 [Note] InnoDB: Mutexes and rw_locks use Windows interlocked functions
    2020-03-17 11:34:59 0 [Note] InnoDB: Uses event mutexes
    2020-03-17 11:34:59 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
    2020-03-17 11:34:59 0 [Note] InnoDB: Number of pools: 1
    2020-03-17 11:34:59 0 [Note] InnoDB: Using SSE2 crc32 instructions
    2020-03-17 11:34:59 0 [Note] InnoDB: Initializing buffer pool, total size = 16M, instances = 1, chunk size = 16M
    2020-03-17 11:34:59 0 [Note] InnoDB: Completed initialization of buffer pool
    2020-03-17 11:34:59 0 [Note] InnoDB: 128 out of 128 rollback segments are active.
    2020-03-17 11:34:59 0 [Note] InnoDB: Creating shared tablespace for temporary tables
    2020-03-17 11:34:59 0 [Note] InnoDB: Setting file 'E:\xampp\mysql\data\ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
    2020-03-17 11:34:59 0 [Note] InnoDB: File 'E:\xampp\mysql\data\ibtmp1' size is now 12 MB.
    2020-03-17 11:34:59 0 [Note] InnoDB: Waiting for purge to start
    2020-03-17 11:34:59 0 [Note] InnoDB: 10.4.11 started; log sequence number 1442695; transaction id 5151
    2020-03-17 11:34:59 0 [Note] InnoDB: Loading buffer pool(s) from E:\xampp\mysql\data\ib_buffer_pool
    2020-03-17 11:34:59 0 [Note] Plugin 'FEEDBACK' is disabled.
    2020-03-17 11:34:59 0 [Note] Server socket created on IP: '::'.
    2020-03-17 11:34:59 0 [Note] InnoDB: Buffer pool(s) load completed at 200317 11:34:59
    InnoDB: using atomic writes.
    2020-03-17 11:35:19 0 [Note] InnoDB: Mutexes and rw_locks use Windows interlocked functions
    2020-03-17 11:35:19 0 [Note] InnoDB: Uses event mutexes
    2020-03-17 11:35:19 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
    2020-03-17 11:35:19 0 [Note] InnoDB: Number of pools: 1
    2020-03-17 11:35:19 0 [Note] InnoDB: Using SSE2 crc32 instructions
    2020-03-17 11:35:19 0 [Note] InnoDB: Initializing buffer pool, total size = 16M, instances = 1, chunk size = 16M
    2020-03-17 11:35:19 0 [Note] InnoDB: Completed initialization of buffer pool
    2020-03-17 11:35:19 0 [Note] InnoDB: 128 out of 128 rollback segments are active.
    2020-03-17 11:35:19 0 [Note] InnoDB: Creating shared tablespace for temporary tables
    2020-03-17 11:35:19 0 [Note] InnoDB: Setting file 'E:\xampp\mysql\data\ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
    2020-03-17 11:35:19 0 [Note] InnoDB: File 'E:\xampp\mysql\data\ibtmp1' size is now 12 MB.
    2020-03-17 11:35:19 0 [Note] InnoDB: Waiting for purge to start
    2020-03-17 11:35:19 0 [Note] InnoDB: 10.4.11 started; log sequence number 1442704; transaction id 5151
    2020-03-17 11:35:19 0 [Note] InnoDB: Loading buffer pool(s) from E:\xampp\mysql\data\ib_buffer_pool
    2020-03-17 11:35:19 0 [Note] Plugin 'FEEDBACK' is disabled.
    2020-03-17 11:35:19 0 [Note] Server socket created on IP: '::'.
    2020-03-17 11:35:19 0 [Note] InnoDB: Buffer pool(s) load completed at 200317 11:35:19
    InnoDB: using atomic writes.
    2020-03-17 11:35:38 0 [Note] InnoDB: Mutexes and rw_locks use Windows interlocked functions
    2020-03-17 11:35:38 0 [Note] InnoDB: Uses event mutexes
    2020-03-17 11:35:38 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
    2020-03-17 11:35:38 0 [Note] InnoDB: Number of pools: 1
    2020-03-17 11:35:38 0 [Note] InnoDB: Using SSE2 crc32 instructions
    2020-03-17 11:35:38 0 [Note] InnoDB: Initializing buffer pool, total size = 16M, instances = 1, chunk size = 16M
    2020-03-17 11:35:38 0 [Note] InnoDB: Completed initialization of buffer pool
    2020-03-17 11:35:38 0 [Note] InnoDB: 128 out of 128 rollback segments are active.
    2020-03-17 11:35:38 0 [Note] InnoDB: Creating shared tablespace for temporary tables
    2020-03-17 11:35:38 0 [Note] InnoDB: Setting file 'E:\xampp\mysql\data\ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
    2020-03-17 11:35:38 0 [Note] InnoDB: File 'E:\xampp\mysql\data\ibtmp1' size is now 12 MB.
    2020-03-17 11:35:38 0 [Note] InnoDB: Waiting for purge to start
    2020-03-17 11:35:38 0 [Note] InnoDB: 10.4.11 started; log sequence number 1442713; transaction id 5151
    2020-03-17 11:35:38 0 [Note] InnoDB: Loading buffer pool(s) from E:\xampp\mysql\data\ib_buffer_pool
    2020-03-17 11:35:38 0 [Note] Plugin 'FEEDBACK' is disabled.
    2020-03-17 11:35:38 0 [Note] Server socket created on IP: '::'.
    2020-03-17 11:35:38 0 [Note] InnoDB: Buffer pool(s) load completed at 200317 11:35:38
    InnoDB: using atomic writes.
    2020-03-17 11:35:40 0 [Note] InnoDB: Mutexes and rw_locks use Windows interlocked functions
    2020-03-17 11:35:40 0 [Note] InnoDB: Uses event mutexes
    2020-03-17 11:35:40 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
    2020-03-17 11:35:40 0 [Note] InnoDB: Number of pools: 1
    2020-03-17 11:35:40 0 [Note] InnoDB: Using SSE2 crc32 instructions
    2020-03-17 11:35:40 0 [Note] InnoDB: Initializing buffer pool, total size = 16M, instances = 1, chunk size = 16M
    2020-03-17 11:35:40 0 [Note] InnoDB: Completed initialization of buffer pool
    2020-03-17 11:35:40 0 [Note] InnoDB: 128 out of 128 rollback segments are active.
    2020-03-17 11:35:40 0 [Note] InnoDB: Creating shared tablespace for temporary tables
    2020-03-17 11:35:40 0 [Note] InnoDB: Setting file 'E:\xampp\mysql\data\ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
    2020-03-17 11:35:40 0 [Note] InnoDB: File 'E:\xampp\mysql\data\ibtmp1' size is now 12 MB.
    2020-03-17 11:35:40 0 [Note] InnoDB: Waiting for purge to start
    2020-03-17 11:35:40 0 [Note] InnoDB: 10.4.11 started; log sequence number 1442722; transaction id 5151
    2020-03-17 11:35:40 0 [Note] InnoDB: Loading buffer pool(s) from E:\xampp\mysql\data\ib_buffer_pool
    2020-03-17 11:35:40 0 [Note] Plugin 'FEEDBACK' is disabled.
    2020-03-17 11:35:40 0 [Note] Server socket created on IP: '::'.
    2020-03-17 11:35:40 0 [Note] InnoDB: Buffer pool(s) load completed at 200317 11:35:40
    InnoDB: using atomic writes.
    2020-03-17 11:36:43 0 [Note] InnoDB: Mutexes and rw_locks use Windows interlocked functions
    2020-03-17 11:36:43 0 [Note] InnoDB: Uses event mutexes
    2020-03-17 11:36:43 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
    2020-03-17 11:36:43 0 [Note] InnoDB: Number of pools: 1
    2020-03-17 11:36:43 0 [Note] InnoDB: Using SSE2 crc32 instructions
    2020-03-17 11:36:43 0 [Note] InnoDB: Initializing buffer pool, total size = 16M, instances = 1, chunk size = 16M
    2020-03-17 11:36:43 0 [Note] InnoDB: Completed initialization of buffer pool
    2020-03-17 11:36:43 0 [Note] InnoDB: 128 out of 128 rollback segments are active.
    2020-03-17 11:36:43 0 [Note] InnoDB: Creating shared tablespace for temporary tables
    2020-03-17 11:36:43 0 [Note] InnoDB: Setting file 'E:\xampp\mysql\data\ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
    2020-03-17 11:36:43 0 [Note] InnoDB: File 'E:\xampp\mysql\data\ibtmp1' size is now 12 MB.
    2020-03-17 11:36:43 0 [Note] InnoDB: Waiting for purge to start
    2020-03-17 11:36:43 0 [Note] InnoDB: 10.4.11 started; log sequence number 1442731; transaction id 5151
    2020-03-17 11:36:43 0 [Note] InnoDB: Loading buffer pool(s) from E:\xampp\mysql\data\ib_buffer_pool
    2020-03-17 11:36:43 0 [Note] Plugin 'FEEDBACK' is disabled.
    2020-03-17 11:36:43 0 [Note] Server socket created on IP: '::'.
    2020-03-17 11:36:43 0 [Note] InnoDB: Buffer pool(s) load completed at 200317 11:36:43
    InnoDB: using atomic writes.
    2020-03-17 11:37:38 0 [Note] InnoDB: Mutexes and rw_locks use Windows interlocked functions
    2020-03-17 11:37:38 0 [Note] InnoDB: Uses event mutexes
    2020-03-17 11:37:38 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
    2020-03-17 11:37:38 0 [Note] InnoDB: Number of pools: 1
    2020-03-17 11:37:38 0 [Note] InnoDB: Using SSE2 crc32 instructions
    2020-03-17 11:37:38 0 [Note] InnoDB: Initializing buffer pool, total size = 16M, instances = 1, chunk size = 16M
    2020-03-17 11:37:38 0 [Note] InnoDB: Completed initialization of buffer pool
    2020-03-17 11:37:39 0 [Note] InnoDB: 128 out of 128 rollback segments are active.
    2020-03-17 11:37:39 0 [Note] InnoDB: Creating shared tablespace for temporary tables
    2020-03-17 11:37:39 0 [Note] InnoDB: Setting file 'E:\xampp\mysql\data\ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
    2020-03-17 11:37:39 0 [Note] InnoDB: File 'E:\xampp\mysql\data\ibtmp1' size is now 12 MB.
    2020-03-17 11:37:39 0 [Note] InnoDB: Waiting for purge to start
    2020-03-17 11:37:39 0 [Note] InnoDB: 10.4.11 started; log sequence number 1442740; transaction id 5151
    2020-03-17 11:37:39 0 [Note] InnoDB: Loading buffer pool(s) from E:\xampp\mysql\data\ib_buffer_pool
    2020-03-17 11:37:39 0 [Note] Plugin 'FEEDBACK' is disabled.
    2020-03-17 11:37:39 0 [Note] InnoDB: Buffer pool(s) load completed at 200317 11:37:39
    2020-03-17 11:37:39 0 [Note] Server socket created on IP: '::'.
    InnoDB: using atomic writes.
    2020-03-17 11:38:26 0 [Note] InnoDB: Mutexes and rw_locks use Windows interlocked functions
    2020-03-17 11:38:26 0 [Note] InnoDB: Uses event mutexes
    2020-03-17 11:38:26 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
    2020-03-17 11:38:26 0 [Note] InnoDB: Number of pools: 1
    2020-03-17 11:38:26 0 [Note] InnoDB: Using SSE2 crc32 instructions
    2020-03-17 11:38:26 0 [Note] InnoDB: Initializing buffer pool, total size = 16M, instances = 1, chunk size = 16M
    2020-03-17 11:38:26 0 [Note] InnoDB: Completed initialization of buffer pool
    2020-03-17 11:38:26 0 [Note] InnoDB: 128 out of 128 rollback segments are active.
    2020-03-17 11:38:26 0 [Note] InnoDB: Creating shared tablespace for temporary tables
    2020-03-17 11:38:26 0 [Note] InnoDB: Setting file 'E:\xampp\mysql\data\ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
    2020-03-17 11:38:26 0 [Note] InnoDB: File 'E:\xampp\mysql\data\ibtmp1' size is now 12 MB.
    2020-03-17 11:38:26 0 [Note] InnoDB: Waiting for purge to start
    2020-03-17 11:38:26 0 [Note] InnoDB: 10.4.11 started; log sequence number 1442749; transaction id 5151
    2020-03-17 11:38:26 0 [Note] InnoDB: Loading buffer pool(s) from E:\xampp\mysql\data\ib_buffer_pool
    2020-03-17 11:38:26 0 [Note] Plugin 'FEEDBACK' is disabled.
    2020-03-17 11:38:26 0 [Note] Server socket created on IP: '::'.
    2020-03-17 11:38:26 0 [Note] InnoDB: Buffer pool(s) load completed at 200317 11:38:26
    InnoDB: using atomic writes.
    2020-03-17 11:42:40 0 [Note] InnoDB: The first innodb_system data file 'ibdata1' did not exist. A new tablespace will be created!
    2020-03-17 11:42:40 0 [Note] InnoDB: Mutexes and rw_locks use Windows interlocked functions
    2020-03-17 11:42:40 0 [Note] InnoDB: Uses event mutexes
    2020-03-17 11:42:40 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
    2020-03-17 11:42:40 0 [Note] InnoDB: Number of pools: 1
    2020-03-17 11:42:40 0 [Note] InnoDB: Using SSE2 crc32 instructions
    2020-03-17 11:42:40 0 [Note] InnoDB: Initializing buffer pool, total size = 16M, instances = 1, chunk size = 16M
    2020-03-17 11:42:40 0 [Note] InnoDB: Completed initialization of buffer pool
    2020-03-17 11:42:40 0 [Note] InnoDB: Setting file 'E:\xampp\mysql\data\ibdata1' size to 10 MB. Physically writing the file full; Please wait ...
    2020-03-17 11:42:40 0 [Note] InnoDB: File 'E:\xampp\mysql\data\ibdata1' size is now 10 MB.
    2020-03-17 11:42:40 0 [Note] InnoDB: Setting log file E:\xampp\mysql\data\ib_logfile101 size to 5242880 bytes
    2020-03-17 11:42:40 0 [Note] InnoDB: Setting log file E:\xampp\mysql\data\ib_logfile1 size to 5242880 bytes
    2020-03-17 11:42:40 0 [Note] InnoDB: Renaming log file E:\xampp\mysql\data\ib_logfile101 to E:\xampp\mysql\data\ib_logfile0
    2020-03-17 11:42:40 0 [Note] InnoDB: New log files created, LSN=11452
    2020-03-17 11:42:40 0 [Note] InnoDB: Doublewrite buffer not found: creating new
    2020-03-17 11:42:40 0 [Note] InnoDB: Doublewrite buffer created
    2020-03-17 11:42:40 0 [Note] InnoDB: 128 out of 128 rollback segments are active.
    2020-03-17 11:42:40 0 [Note] InnoDB: Creating foreign key constraint system tables.
    2020-03-17 11:42:40 0 [Note] InnoDB: Creating tablespace and datafile system tables.
    2020-03-17 11:42:40 0 [Note] InnoDB: Creating sys_virtual system tables.
    2020-03-17 11:42:40 0 [Note] InnoDB: Creating shared tablespace for temporary tables
    2020-03-17 11:42:40 0 [Note] InnoDB: Setting file 'E:\xampp\mysql\data\ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
    2020-03-17 11:42:40 0 [Note] InnoDB: File 'E:\xampp\mysql\data\ibtmp1' size is now 12 MB.
    2020-03-17 11:42:40 0 [Note] InnoDB: Waiting for purge to start
    2020-03-17 11:42:40 0 [Note] InnoDB: 10.4.11 started; log sequence number 0; transaction id 7
    2020-03-17 11:42:40 0 [Note] Plugin 'FEEDBACK' is disabled.
    2020-03-17 11:42:40 0 [Note] Server socket created on IP: '::'.
    InnoDB: using atomic writes.
    2020-03-17 11:42:48 0 [Note] InnoDB: Mutexes and rw_locks use Windows interlocked functions
    2020-03-17 11:42:48 0 [Note] InnoDB: Uses event mutexes
    2020-03-17 11:42:48 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
    2020-03-17 11:42:48 0 [Note] InnoDB: Number of pools: 1
    2020-03-17 11:42:48 0 [Note] InnoDB: Using SSE2 crc32 instructions
    2020-03-17 11:42:48 0 [Note] InnoDB: Initializing buffer pool, total size = 16M, instances = 1, chunk size = 16M
    2020-03-17 11:42:48 0 [Note] InnoDB: Completed initialization of buffer pool
    2020-03-17 11:42:48 0 [Note] InnoDB: 128 out of 128 rollback segments are active.
    2020-03-17 11:42:48 0 [Note] InnoDB: Creating shared tablespace for temporary tables
    2020-03-17 11:42:48 0 [Note] InnoDB: Setting file 'E:\xampp\mysql\data\ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
    2020-03-17 11:42:48 0 [Note] InnoDB: File 'E:\xampp\mysql\data\ibtmp1' size is now 12 MB.
    2020-03-17 11:42:48 0 [Note] InnoDB: Waiting for purge to start
    2020-03-17 11:42:48 0 [Note] InnoDB: 10.4.11 started; log sequence number 47055; transaction id 9
    2020-03-17 11:42:48 0 [Note] InnoDB: Loading buffer pool(s) from E:\xampp\mysql\data\ib_buffer_pool
    2020-03-17 11:42:48 0 [Note] Plugin 'FEEDBACK' is disabled.
    2020-03-17 11:42:48 0 [Note] InnoDB: Buffer pool(s) load completed at 200317 11:42:48
    2020-03-17 11:42:48 0 [Note] Server socket created on IP: '::'.

     

  3. hi,

    i have pdo with select statement and trying to put 3 where clauses, why it is not working?

    code:

    $conn = new PDO("mysql:host=$servername;dbname=timeclock", $username, $password);
    			// set the PDO error mode to exception
    			$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
    
    					$res = $conn->query("SELECT oracleid
                             , name 
                             , des 
                             , clockingindate   as clockin
                             , clockingoutdate  as clockout
                             , timediff(clockingoutdate, clockingindate) as duration
                             , total
                        FROM attendance_records
                             JOIN (
                                    SELECT oracleid
                                         , sec_to_time(sum(timestampdiff(SECOND, clockingindate, clockingoutdate))) as total
                                    FROM attendance_records
    								where isdone =-1
                                    GROUP BY oracleid
                                  ) tots USING (oracleid)
    							  where isdone =-1, DATE(ClockingOutDate) >= $sdate1, DATE(ClockingOutDate) <= $edate1
                        ORDER BY oracleid, clockingindate
                        ");

    3rd line from last i have 3 clauses, please advise

  4. Hi, 

    i am trying to add where clause to the code below:

    $res = $conn->query("SELECT oracleid
                             , name 
                             , des 
                             , clockingindate   as clockin
                             , clockingoutdate  as clockout
                             , timediff(clockingoutdate, clockingindate) as duration
                             , total
                        FROM attendance_records
                             JOIN (
                                    SELECT oracleid
                                         , sec_to_time(sum(timestampdiff(SECOND, clockingindate, clockingoutdate))) as total
                                    FROM attendance_records
                                    GROUP BY oracleid
                                  ) tots USING (oracleid)
                        ORDER BY oracleid, clockingindate
                        ");

    i need to add where clause as following:

    From attendance_records where isdone = -1
    Join...

    how to achieve that

  5. 1 hour ago, Barand said:

    pdoConnect() is my custom function which does what you have already done in the lines above it. Remove that line and replace $db in my code with $conn (as that is the connection you are creating) .

    Thank you, its working now. as for the select statement how to add where clause?

    $res = $conn->query("SELECT oracleid
                             , name 
                             , des 
                             , clockingindate   as clockin
                             , clockingoutdate  as clockout
                             , timediff(clockingoutdate, clockingindate) as duration
                             , total
                        FROM attendance_records (where isdone = -1)
                             JOIN (
                                    SELECT oracleid
                                         , sec_to_time(sum(timestampdiff(SECOND, clockingindate, clockingoutdate))) as total
                                    FROM attendance_records
                                    GROUP BY oracleid
                                  ) tots USING (oracleid)
                        ORDER BY oracleid, clockingindate
                        ");

     

  6. Hi,

    I am trying to use PDO but i am stuck, what is the problem?

    code:

    <?php
    
    
    $servername = "localhost";
    $username = "someuser";
    $password = "somepassword";
    
        $conn = new PDO("mysql:host=$servername;dbname=timeclock", $username, $password);
        // set the PDO error mode to exception
        $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
    
    $db = pdoConnect('test');

    i get error: 

    Fatal error: Uncaught Error: Call to undefined function pdoConnect() in E:\xampp\htdocs\AttendanceSystem\total.php:12 Stack trace: #0 {main} thrown in E:\xampp\htdocs\AttendanceSystem\total.php on line 12

     

  7. 6 hours ago, Barand said:

    try

    
    <?php
    require 'db_inc.php';
    $db = pdoConnect('test');
    
    $res = $db->query("SELECT oracleid
                             , name 
                             , des 
                             , clockingindate   as clockin
                             , clockingoutdate  as clockout
                             , timediff(clockingoutdate, clockingindate) as duration
                             , total
                        FROM attendance_record 
                             JOIN (
                                    SELECT oracleid
                                         , sec_to_time(sum(timestampdiff(SECOND, clockingindate, clockingoutdate))) as total
                                    FROM attendance_record
                                    GROUP BY oracleid
                                  ) tots USING (oracleid)
                        ORDER BY oracleid, clockingindate
                        ");
    
    ?>
    <html>
    <body>
            <table border='1' style='border-collapse:collapse; width: 700px;'>
                <tr><th>OracleID</th><th>Name</th><th>Designation</th><th>Clock In</th><th>Clock Out</th><th>Duration</th></tr>
            <?php
                $previd = 0;
                foreach ($res as $row) {
                    if ($row['oracleid'] != $previd) {                              // id changed so output total
                        if ($previd != 0) {
                            echo "<tr><td colspan='4'</td><td>Total:</td><td>$total</td></tr>";
                        }
                        $previd = $row['oracleid'];
                    }
                    echo "<tr><td>{$row['oracleid']}</td>
                              <td>{$row['name']}</td>
                              <td>{$row['des']}</td>
                              <td>{$row['clockin']}</td>
                              <td>{$row['clockout']}</td>
                              <td>{$row['duration']}</td>
                              </tr>
                         ";
                    $total = $row['total'];
                }
                echo "<tr><td colspan='4'</td><td>Total:</td><td>$total</td></tr>";    // dont forget total for last id
            ?>
            
            </table>
    </body>
    </html>

    image.png.d875a366b3de4c2e703ef4ef97d75602.png

    Thanks for the help but i am new to php and don't know how to run the pdo, can you guide me how to connect with mysqli

  8. 25 minutes ago, mac_gyver said:

    what do you want the output to actually be? where do you want to show the totals and do you really want to repeat all the id/name/designation information?

    I am new so it into show ID, name and designation once then attendance records for that ID. the total after each ID group. In my example ID 533349 then total for that then ID 533355 then total for that.

  9. Hi,

    I have database, screenshot attached. I have to print all records of attendance sort by ID and have sum group by ID. How to know or figure out when the ID changes so that i can show the total for that ID. Bare with me please and try to show me where is my mistake!

    Code:

    <?Php
    
    	include('session.php');
    	include('dbcon.php');
    	
    ?>
    
    <html>
    <head>
    <link rel="stylesheet" type="text/css" href="bootstrap.css">
    </head>
    
    <body>
    	
    	<div class="container">
    		<div class="row">
    			<div class="col m-auto">
    				<div class="card mt-5">
    					<table class="table table-bordered">
    					
    						<tr>
    
    							<input type="button" onClick="window.print()" value="Print The Report"/>
    							<td>OracleID</td>
    							<td>Name</td>
    							<td>Designation</td>
    							<td>Clocking In Time</td>
    							<td>Clocking Out Time</td>
    							<td>Duration</td>
    						
    						</tr>
    						
    						<?php
    						
    							$isdone = -1;
    							
    							$query = "select * from attendance_records where isdone= '".$isdone."' order by OracleID";
    							$result = mysqli_query($con, $query);
    																			
    							$query2 = "SELECT sec_to_time(SUM(timestampdiff(SECOND, ClockingInDate, ClockingOutDate))) as total from attendance_records group by OracleID";
    							$result2 = mysqli_query($con, $query2);
    							
    							while ($row = mysqli_fetch_assoc($result))
    							{
    								
    								$userid = $row['OracleID'];
    								$name = $row['Name'];
    								$des = $row['Des'];
    								$clockingindate = $row['ClockingInDate'];
    								$clockingoutdate = $row['ClockingOutDate'];
    								$duration = $row['Duration'];
    								$t=time();
    								$curdate = date("d-m-Y",$t);
    								$curTime = date("g:i:s A",$t);
    																		
    						?>
    						
    						<tr>
    						
    							<td><?php echo $userid ?></td>
    							<td><?php echo $name ?></td>
    							<td><?php echo $des ?></td>
    							<td><?php echo $clockingindate ?></td>
    							<td><?php echo $clockingoutdate ?></td>
    							<td><?php echo $duration ?></td>
    		
    						</tr>
    						
    						<?php									
    							
    							}	
    								while($row2 = mysqli_fetch_assoc($result2))
    									{
    										$totals= $row2['total'];
    									
    										echo '<td><h5>Total Attendance Time:</h5></td>';
    										echo '<td>';
    										echo $totals; 
    										echo '</td>';
    									}						
    										
    							
    								echo '<tr>';
    								echo 'Report created by ', $_SESSION['user_id2'], ' on ', $curdate, ' at ', $curTime;
    								
    								echo '</tr>';
    							
    						?>
    						
    					</table>
    					
    					<a href="home.php" width="100%">Click here to go back to Main Menu</a>
    			
    				</div>
    			</div>
    		</div>
    	</div>
    
    </body>
    
    </html>

    and screenshot of result is attached. I have the totals but not at the end of each OracleID, it is at the end of the report.

    Thanks.

    screen.png

  10. 12 minutes ago, Barand said:
    
    mysql> SELECT login_time, logout_time FROM login;
    +---------------------+---------------------+
    | login_time          | logout_time         |
    +---------------------+---------------------+
    | 2020-03-09 09:15:00 | 2020-03-09 15:00:00 |
    | 2020-03-10 09:30:00 | 2020-03-10 16:00:00 |
    | 2020-03-11 09:00:00 | 2020-03-11 13:30:00 |
    +---------------------+---------------------+
    3 rows in set (0.00 sec)
    
    mysql> SELECT sec_to_time(SUM(timestampdiff(SECOND, login_time, logout_time))) as total
        -> FROM login;
    +----------+
    | total    |
    +----------+
    | 16:45:00 |
    +----------+

     

    Thank you very very much

  11. 12 minutes ago, ginerjm said:

    $totals= gmdate("H:i:s",$row2['totals']);

    this function makes the answer wrong! after being correct. please help. i read about it it has to deal with GMT timing, i don't want time or date, this is a sum of times so i think my answer is number just like it shows in my screenshot 130033, i want to show that as 13:00:33

  12. 42 minutes ago, gw1500se said:

    Start by changing that column to data type TIME. That stores it as hh:mm:ss.  Then use:

    
    $totaltime=strtotime($time1)+strtotime($time2)+...   ;
    echo gmdate("H:i:s",$totaltime); // If you want it back to hh:mm:ss or set whatever format you want.

     

    it is of datatype time and i am getting the total after looping through records but getting the total as full string like 130033 instead of 13:00:33, if i put your code i lose some time as it becomes 12:07:13 not sure why is that but my numbers are the correct one but need to put the ":" signs, any idea?

    correct.png

    Code used to get the correct time:

    $query2 = "select sum(Duration) as totals from attendance_records where OracleID = '".$userid."' and isdone= '".$isdone."' and DATE(ClockingOutDate) >= '".$sdate1."' and DATE(ClockingOutDate) <= '".$edate1."'";
    							
    $result2 = mysqli_query($con, $query2);
    							
    			while ($row2 = mysqli_fetch_assoc($result2))
    			{
    				$totals= $row2['totals'];		
    			}
    						
    			?>
    						
    			<td><td><td><td><td><h5>Total Attendance Time:</h5></td></td></td></td></td>
    			<td><?php echo $totals ?></td>
    	

     

  13. Hi,

    I have an attendance system that calculates time in and time out for each day. I have a db field with time datatype that stores the total time for one day, say for example for today the total is 7:15:00 (7 hours and fifteen minutes).  i am making a report to show all attendance records for a week. I need to show total of hours a week which is around 35-40 hours so how can this be done?

    screenshot of what i have.

    screen.png

  14. 1 minute ago, requinix said:

    Remember what I said about using a form?

    Use a form.

    yes i did, I am using a form but putting the type to date gives me to pick dates only with no time.

    code:
     

    <form action="#" method="post">
    
    	<input type="date" name="sdate" required="required"></input>
    	<input type="date" name="edate" required="required"></input>
    	<input type="submit" name="saveit" value="Generate"></input>
    	
    </form>

     

  15. 14 minutes ago, requinix said:

    I'm not sure I followed that question but I think the right reply is something like "if you enter 3-15-2020 as the date then what is the time?"

    that is what i suspected but how to get the timestamp from date picker in php forms then?

  16. 31 minutes ago, ramiwahdan said:

    I am using the link to get the exact information of specific user in the db, from that I will generate a report of attendance. I am trying to have 2 fields of dates (Start and End) so that then i will go to next page and use that information to get the reports based on the selected dates.

    from 3-1-2020 to 3-15-2020, this will generate report of attendance from 3-1-2020 until 3-15-2020 instead of getting all dates. That is my aim. so i am using the link to refer to the right user by his id.

    Is there a better way.

     

    screenshot attached, this is getting all dates i need the admin to put 2 dates "From and To" then generates based on selection.

     

    screen.png

    i solved it with only one problem, if i choose 3-1-2020 to 3-15-2020 i get only one record excluding the 3-15-2020 but i put 3-1-2020 to 3-16-2020 i get both, there is 1 day difference why is that?

    code :

    		$sdate1 = $_POST['sdate'];
    		$edate1 = $_POST['edate'];
    							
    		$query = "select * from attendance_records where OracleID = '".$userid."' and isdone= '".$isdone."' and ClockingInDate >= '".$sdate1."' and ClockingOutDate <= '".$edate1."'";
    		$result = mysqli_query($con, $query);

    where clockingindate is start date in DB, clockingoutdate is end date in DB. sdate and edate are taken from admin user in the form.

  17. 1 hour ago, requinix said:

    Use a form, not a link.

    I am using the link to get the exact information of specific user in the db, from that I will generate a report of attendance. I am trying to have 2 fields of dates (Start and End) so that then i will go to next page and use that information to get the reports based on the selected dates.

    from 3-1-2020 to 3-15-2020, this will generate report of attendance from 3-1-2020 until 3-15-2020 instead of getting all dates. That is my aim. so i am using the link to refer to the right user by his id.

    Is there a better way.

     

    screenshot attached, this is getting all dates i need the admin to put 2 dates "From and To" then generates based on selection.

     

    screen.png

  18. 16 minutes ago, ramiwahdan said:

    Hi,

    I have a form that has start date and end date in the form plus link to generate a report. the link will go to other page but i need to be able to get the values of the 2 date fields from the first page. how to do that?

    <?php
    						
    							while($row=mysqli_fetch_assoc($result))
    							{
    								
    								$userid = $row['OracleID'];
    								$name = $row['StaffName'];
    								$des = $row['Des'];
    						
    						?>
    						
    						<tr>
    						
    							<td><?php echo $userid ?></td>
    							<td><?php echo $name ?></td>
    							<td><?php echo $des ?></td>
    							<td><input type="date" name="startdate"></td>
    							<td><input type="date" name="enddate"></td>
    							<td><a href="reportbyidbydate.php?GetID=<?php echo $userid?>&startdate=<?php echo $startdate?> ">Print Full Report</a></td>
    						
    						</tr>
    						
    						<?php
    						
    							}
    						
    						?>

    i am trying to use the get method but for startdate i am not sure how to reference it from the input field

  19. 2 hours ago, Barand said:

    Why are you even attempting to store that duration. You can get it any time you need it with a query. 

    Rule of DB design - don't store derived data.

    If you really insist on storing it, why do need two queries?

    
    UPDATE attendance_records
    SET duration = timediff(...)
    WHERE ...

    - a single update would do the job

    I tried to do that if less than minute its fine but i tried 1 minute or more i get wrong result. Attached is a screenshot of 1 minute but giving result of 100 instead of 60 in seconds 

    screenshot.png

  20. 10 minutes ago, Barand said:
    
    mysql> select login_time
        ->      , logout_time
        ->      , timediff(logout_time, login_time) as diff
        -> FROM login;
    +---------------------+---------------------+----------+
    | login_time          | logout_time         | diff     |
    +---------------------+---------------------+----------+
    | 2020-03-12 12:30:00 | 2020-03-13 15:02:30 | 26:32:30 |
    +---------------------+---------------------+----------+

     

    Thanks, I tried it but still no results.

    code:

    $result3=mysqli_query($con, "select ClockingInDate, ClockingOutDate, timediff(ClockingOutDate,ClockingInDate) as diff from attendance_records where OracleID='$session_id'")or die('Error In Session');
    		$row3=mysqli_fetch_array($result3);
    
    		$duration = $row3['diff'];
    		$query3=mysqli_query($con, "update attendance_records set Duration = '$duration' where OracleID='$session_id' and isdone='$isdone'")or die('Error In Session');

     

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.