<?php
$con = mysql_connect("localhost","root","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("ms", $con);
$time1 = $row['timein'];
$time2 = $row['timeout'];
$sql = mysql_query("SELECT employees.*, timetable.* FROM employees INNER JOIN timetable ON
employees.id = timetable.id WHERE timetable.in_time BETWEEN employees.timein AND employees.timeout ");
echo "<table width='734'>
<tr>
<th width='49' scope='col'>Employee ID</th>
<th width='49' scope='col'>Lastname</th>
<th width='49' scope='col'>Firstname</th>
<th width='49' scope='col'>Department</th>
<th width='49' scope='col'>Time In</th>
<th width='49' scope='col'>Time Out</th>
</tr>";
while ($row = mysql_fetch_array($sql))
{
echo "<tr>";
echo "<td class='align-center'> " . $row['id'] . " </td>";
echo "<td> " . $row['Lastname'] ." </td>";
echo "<td> " . $row['Name'] . " </td>";
echo "<td> " . $row['Department'] . " </td>";
echo "<td class='align-center'> " . $row['in_time'] . " </td>";
echo "<td class='align-center'> " . $row['out_time'] . " </td>";
echo "</tr>";
};
echo "</table>";
mysql_close($con);
?>
shhh
0
Light Poster
Recommended Answers
Jump to Post@shhh
Can you post your table? So I can see what you have. The code you provide is a JOIN but having to see the actually table will make more sense!
Jump to Postwhat is in time, is it same for all or is it diffent for all
Jump to PostThis query shows all record who come after their standard in time.
$sql = mysql_query("SELECT employees.*, timetable.* FROM employees INNER JOIN timetable ON employees.id = timetable.id WHERE timetable.in_time > str_to_date(concat(timetable.date,' ',employees.timein) ,'%Y-%m-%d %r')");
All 11 Replies
LastMitch
shhh
0
Light Poster
shhh
0
Light Poster
urtrivedi
276
Nearly a Posting Virtuoso
shhh
0
Light Poster
urtrivedi
276
Nearly a Posting Virtuoso
shhh
0
Light Poster
LastMitch
shhh
0
Light Poster
LastMitch
urtrivedi
276
Nearly a Posting Virtuoso
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.