Coding a Daily Attendance Register in PHP

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • pardhu
    New Member
    • Jun 2007
    • 3

    Coding a Daily Attendance Register in PHP

    I just need the code for this plz help me
  • jaxpylon
    New Member
    • Jun 2007
    • 4

    #2
    I assume you already have some users table in the database?

    What you need to do is create a new table in your database - let's say DailyRoster.

    Code:
    CREATE TABLE DailyRoster {
        id_user int(11) NOT NULL, -- Should be the same as the key in your users table
        date datetime NOT NULL,
        PRIMARY KEY (id_user, date)
    };
    Then, just put this on your page. This will check if a user's id session variable is set (replace the name to that of your session variable), and replace the current date into the table. $connect should be your database connection.

    Code:
    if (isset($_SESSION['id_user'])) {
        $user_id = $_SESSION['id_user'];
        $query_updateRoster = "REPLACE INTO DailyRoster VALUES ('$user_id', date('Y-m-d', getdate()));
        mysql_query($query_updateRoster, $connect);
    }

    Comment

    • ak1dnar
      Recognized Expert Top Contributor
      • Jan 2007
      • 1584

      #3
      Originally posted by pardhu
      I just need the code for this plz help me

      Posting Homework or Coursework Questions and Answers

      This site is not a place where you can get your homework and course work done for you. Ignoring the questionable morals of getting someone else to do your work towards a formal qualification you will learn a lot more by attempting the problem yourself, then asking for help with the bits that are not working. You will be more likely to get help if you appear to have made an attempt at the problem yourself.

      Comment

      • pbmods
        Recognized Expert Expert
        • Apr 2007
        • 5821

        #4
        Changed thread title to better describe the problem.

        If you want someone to do your coding for you, I'd be happy to refer you to my employer. TSDN members are expected to write their own code.

        Comment

        Working...