Andu Jame Posted May 7, 2007 Share Posted May 7, 2007 well..im doing my final project for my studies (I'm very basic to using php) Using php 5 to create a system punch card for student attendance, i'm stuck when doing weekday function. Can somebody help me??? Quote Link to comment https://forums.phpfreaks.com/topic/50326-helpme/ Share on other sites More sharing options...
warewolfe Posted May 7, 2007 Share Posted May 7, 2007 what do you need help with? Quote Link to comment https://forums.phpfreaks.com/topic/50326-helpme/#findComment-247080 Share on other sites More sharing options...
mmarif4u Posted May 7, 2007 Share Posted May 7, 2007 Please post ur code we will try to help u out. Quote Link to comment https://forums.phpfreaks.com/topic/50326-helpme/#findComment-247085 Share on other sites More sharing options...
Andu Jame Posted May 7, 2007 Author Share Posted May 7, 2007 <? include("config/config.php"); include("fungsi_beza_masa.php"); $masa=date('H:i:s'); $i=0; //$masa_awal=mktime(0,10,0,0,0,0); //$masa_lewat=mktime(0,15,0,0,0,0); $hari=date("w"); if($hari<=4 && $hari>=1){ $q="SELECT * FROM slot"; } if($hari==5){ $q="SELECT * FROM slot_j"; } $r=mysql_query($q);s while($row=mysql_fetch_array($r)){ $id_slot=$row["id_slot"]; $masa_slot=$row["masa_slot"]; list($jam_slot, $minit_slot, $saat_slot) = split(":", $masa_slot); //echo "slot : $jam_slot, $minit_slot, $saat_slot<br>"; list($jam, $minit, $saat) = split(":", $masa); //echo "jam biasa : $jam, $minit, $saat<br>"; $t1=date("H:i:s", mktime($jam_slot-$jam, $minit_slot-$minit, $saat_slot-$saat, 0, 0, 0)); $t2=date("H:i:s", mktime($jam-$jam_slot, $minit-$minit_slot, $saat-$saat_slot, 0, 0, 0)); if($t1<'00:10:00'||$t2<'00:15:00'){ echo "Masa Boleh Punch t1 atau t2<tr>"; echo "masa slot semasa = $masa_slot dan masa = $masa,<br> tempoh "; echo "t1 = $t1 dan t2 = $t2<br>"; //insert disini if($hari<=4 && $hari>=1){ $q2="INSERT INTO maklumat_kedatangan (id_pelajar,tarikh,masa,id_slot) VALUES ('$id_pelajar','$tarikh','$masa','$id_slot')"; } if($hari==5){ $q2="INSERT INTO maklumat_kedatangan (id_pelajar,tarikh,masa,id_slot_j) VALUES ('$id_pelajar','$tarikh','$masa','$id_slot_j')"; } //echo "$q<br>"; $r2=mysql_query($q2); echo "Anda Telah Punch"; } //echo "<meta http-equiv=\"refresh\" content=\"1;URL=punch.php\" a target = \"_self\"> "; } echo "<br>Jika mesej \"Anda Telah Punch\" Tidak Keluar, Anda Punch Diluar Waktu"; //echo "<meta http-equiv=\"refresh\" content=\"1;URL=punch.php\" a target = \"_self\"> "; ?> Quote Link to comment https://forums.phpfreaks.com/topic/50326-helpme/#findComment-247090 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.