Pls help me i do had a problem on my code i cant view it when i time in it didnt register in my data base pls help
--------------------------------------------------------
<?
session_start();
if (!(isset($_SESSION['login']) && $_SESSION['login'] != '')) {
header ("Location: login.php");
}
$db_handle = mysql_connect('localhost', 'root', 'root');
$db_found = mysql_select_db('misd_ojt', $db_handle);
$id = $_GET['id'];
$sql="SELECT * FROM users where username='$name'";
$result=mysql_query($sql);
?>
<html>
<head>
<style type="text/css">
body{background-image : URL(images/bg.gif); background-repeat : repeat-x,y }
.header {
height:45px;
background-color: #006600;
border: solid #cdc0b0;
border-width: 1px5px 1px 1px;
}
.top_rows {
background-color: #eeeeee;
border: solid #748771;
border-width: 1px 1px 1px 1px;
padding-left: 10px;
color: #27408b;
font-weight: bold;
}
.menu {
background-color: #eeeeee;
border: solid #748771;
padding-right: 10px;
padding-left:10px;
color: #27408b;
font-weight: bolder;
}
.content {
border: red 1px solid;
padding: 22px 25px 14px 25px;
}
.curlycontainer{
border-width:10px 10px 10px 10px;
border: 1px solid #b8b8b8;
margin-bottom: 1em;
width: 70%;
}
.curlycontainer .innerdiv{
border-width:10px 10px 10px 10px;
background: transparent url(images/brcorner.gif) bottom right no-repeat;
position: relative;
left: 2px;
top: 2px;
padding: 1px 4px 15px 5px;
}
</style>
</head>
<body>
<div align="center">
<? include ('include/header.php'); ?>
</div>
<p class="top_rows" align="left">Administrator Panel</font></div>
<div class="menu" align="center">| <a href="Search.php">Search</a> | <a href="add.php">Add</a> | <a href="edit.php">Edit</a> | <a href="delete.php">Delete</a> | <a href="school.php">School</a> | <a href="skill.php">Skill</a> | <a href="logbook.php">Logbook</a> | <a href="timeinout.php" class="header">Timein-Timeout</a> |</div>
<center>
<div class="curlycontainer" align="justify">
<div class="innerdiv" align="justify">
<b><? echo date('M d Y - H:i A'); ?></b>
<?php
$sql="SELECT * FROM trainee ORDER BY lastname ASC";
$result=mysql_query($sql);
$count=mysql_num_rows($result);
?>
<table width="80%" border="0" cellspacing="1" cellpadding="0">
<tr>
<td><form name="form1" method="post" action="">
<div align="center"><table width="80%" border="0" cellpadding="3" cellspacing="1" bgcolor="#CCCCCC">
<tr>
<td bgcolor="#FFFFFF"> </td>
<td colspan="4" bgcolor="#FFFFFF"><strong>Select Trainee to Timein</strong> </td>
</tr>
<tr>
<td align="center" bgcolor="#FFFFFF"></td>
<td align="center" bgcolor="#FFFFFF"><strong>Username</strong></td>
<td align="center" bgcolor="#FFFFFF"><strong>Name</strong></td>
<td align="center" bgcolor="#FFFFFF"><strong>Lastname</strong></td>
<td align="center" bgcolor="#FFFFFF"><strong>M.I.</strong></td>
<td align="center" bgcolor="#FFFFFF"><strong>Email</strong></td>
</tr>
<?php
while($rows=mysql_fetch_array($result)){
$traineeid=$rows['traineeid'];
?>
<tr>
<td align="center" bgcolor="#FFFFFF"><input name="checkbox[]" type="checkbox" id="checkbox[]" value="<? echo $rows['id']; ?>"></td>
<td bgcolor="#FFF000"><a href=view.php?traineeid=<? echo $traineeid; ?>><? echo $traineeid; ?></td>
<td bgcolor="#FFFFFF"><? echo $rows['firstname']; ?></td>
<td bgcolor="#FFFFFF"><? echo $rows['lastname']; ?></td>
<td bgcolor="#FFFFFF"><? echo $rows['mi']; ?></td>
<td bgcolor="#FFFFFF"><? echo $rows['email']; ?></td>
</tr>
<?php
}
?>
<tr>
<td colspan="5" align="center" bgcolor="#FFFFFF"><input name="timein_" type="submit" id="timein_" value="Timein"></td>
</tr>
<?
// Check if delete button active, start this
if($delete){
for($i=0;$i<$count;$i++){
$up_id = $checkbox[$i];
$sql = "INSERT INTO attendance (uid,traineeid,datepresent,timein,tmpin,timeout,tmpout,earnhourday) VALUES ($up_id,$traineeid,curdate(),curtime(),'yes',curtime(),'no',NULL)";
$result = mysql_query($sql);
}
// if successful redirect to delete_multiple.php
if($result){
echo "<meta http-equiv=\"refresh\" content=\"0;URL=timeinout.php\">";
}
}
mysql_close();
?>
</table>
</form>
</td>
</tr>
</table>
<br />
</div>
</div>
</div>
</center>
<div class="top_rows"> <? include('include/footer.php'); ?></div>
</body>
</html>
Urgent-----------Pls Help......about time in and time out
Moderator: General Moderators
Re: Urgent-----------Pls Help......about time in and time out
i would start by trying to isolate your problem and running some tests.
If you echo $sql insert. what do you get?
is the problem with curtime() ?
Then make a variable for that ($variable) and test it before it's sent to the INSERT.
If you echo $sql insert. what do you get?
is the problem with curtime() ?
Then make a variable for that ($variable) and test it before it's sent to the INSERT.