Comments (2)
i am trying to save attendance in database but i get this error can someone help me ?
Hi Aminechouchene98, i made all updates. But i am still not able to retrieve the datas. Could you advise me how did you do it? Thanks in advance
from zklibrary.
Hi erkutcin ,
This likely seems to be a database issue on your end, and not a device issue with the library.
In my case the uid returns the position the user record is stored in the device while id is the actual user id.
In your case it looks like yours is storing a consecutive id in the uid field and the user id in the id field.
Therefore thw data structure may slightly vary across devices.
As long as you do not clear attendance records the device by using the clearAttendance() function, the device will give you the same data plus the new attendance records.
If you clear the attendance records, which you probably should every once in a while to keep the download from becoming slow,
We worked around this by creating a combined primary key (or you could use a unique index) over the user id and the date time field.
CREATE TABLE ``deviceusers` (
`id` smallint(5) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(75) COLLATE utf8mb4_unicode_ci NOT NULL,
`synctime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`fetched` tinyint(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
);
CREATE TABLE `deviceregs` (
`deviceuser_id` smallint(5) unsigned NOT NULL,
`time` datetime NOT NULL,
`fetched` tinyint(3) unsigned NOT NULL DEFAULT '0',
PRIMARY KEY (`deviceuser_id`,`time`),
CONSTRAINT `deviceregs_deviceuser_id_foreign` FOREIGN KEY (`deviceuser_id`) REFERENCES `deviceusers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
);
This way you could use INSERT IGNORE or capture inserts that fail due to duplication.
I hope this helps.
Sample device attendance:
[23] => Array([0] => 29, [1] => 3, [2] => 0, [3] => 2022-12-09 19:02:00)
[24] => Array([0] => 9, [1] => 9, [2] => 0, [3] => 2022-12-10 07:39:07)
[25] => Array([0] => 163, [1] => 162, [2] => 0, [3] => 2022-12-10 07:41:35)
Sample device users:
[9] => Array([0] => 9, [1] => Josef, [2] => 0, [3] => )
[29] => Array([0] => 3, [1] => Fred, [2] => 14, [3] => 696910)
[163] => Array([0] => 162, [1] => Bernard, [2] => 0, [3] => )
from zklibrary.
Related Issues (20)
- setTime() method not working as intended for me. HOT 1
- Clear Attendance Record
- How can I connect a devices with communication key (password protected devices)
- Can't connect to device with WiFi/WLAN connection
- Unable to connect to ZkTeco 4500 HOT 2
- X302-S
- How to connect with communication key / password HOT 1
- clearAttendance() HOT 4
- github provide the code for attendence machine but data not comes HOT 2
- G4 ZKTECO
- i cant push data to device (setUserTemplate )
- Webserver HOT 3
- MB360 HOT 3
- Time out
- Disconnect function message
- Update user's attendance date/time.
- Check in/Check out
- Can not get attendance with running apache2 on Ubuntu HOT 1
- how to connect to codeigniter, please how
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from zklibrary.