i have a form where the employee should type in-time(attendance)........
i want the user to insert only once in a day.....
if he tries to insert the data in same day the it should display error message.....
lydia21
9
Junior Poster
Recommended Answers
Jump to Postplease display your code..
Jump to Postif (isset($_REQUEST['Submit'])) { $query="Select * from attend WHERE spid='$id3' AND day1='$day'"; $result=mysql_query($query); $num=mysql_num_rows($result); if ($num==0)//if there are no match then insert record... { mysql_query("INSERT INTO attend(spid,day1,time1)VALUES('$id3','$day','$tm1')") or die("ERROR:".mysql_error()); echo "THANKS "; } else { //do nothing or echo something like "you have already logged in".... } }
All 5 Replies
ryan_vietnow
13
Posting Pro
lydia21
9
Junior Poster
ryan_vietnow
13
Posting Pro
ithelp
757
Posting Virtuoso
Banned
lydia21
9
Junior Poster
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.