i want to take the attendence of the students from database...if they once punch-in then i want to disable it upto clicking the punch-out button if browser 've been closed ! so how can i get it can pls anyone help me :) :))

I think you may need to do some research on the Javascript onunload & onbeforeunload events. Maybe have them call an ajax function.

here is an example of the usage.

First you save the user_id, action_type (IN or OUT) and current_time of user on table.
Then check last action type of that user.
If last action_type is IN , show punch out button, else show punch in button.

thanq Varghese can u suggest me the query or code for that after creation of the tables ?

It would look something like this

<?php
    // assuming you have connected to the database and set up the table
    // and your user is already logged in and jsut needs to "punch in"

    $sql = 'SELECT `action_type` FROM `users` WHERE `username` = \'{$username}\' LIMIT 1';
    $result = mysql_query($sql);
    $row = mysql_fetch_assoc($result);
    if ( $row['action_type'] == 'IN' ) {
        // display code to puch out
    } else {
        // display code to punch in
    }
?>

I haven't tested this but it should work with some modifictaion with your existing code.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.