Code: Select all
<?php
$con = mysql_connect("localhost","root","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("check_in", $con);
mysql_select_db("check_out", $con);
$from=$_POST['from'];
$to=$_POST['to'];
// Construct our join query
$result = mysql_query("SELECT visitor1.Name,visitor1.Contact_Number,visitor1.Date,visitor1.Time_In,visitor2.Time_Out FROM visitor1,visitor2 WHERE visitor1.Date BETWEEN '$from' AND '$to' ") or die(mysql_error());
//Printing as a HTML table
echo "<table border='1'>
<tr>
<th>Name</th>
<th>Contact Number</th>
<th>Date</th>
<th>Time In</th>
<th>Time Out</th>
</tr>";
while($row = mysql_fetch_array($result))
{
echo "<tr>";
echo "<td>" . $row['Name'] . "</td>";
echo "<td>" . $row['Contact_Number'] . "</td>";
echo "<td>" . $row['Date'] . "</td>";
echo "<td>" . $row['Time_In'] . "</td>";
echo "<td>" . $row['Time_Out'] . "</td>";
echo "</tr>";
}
echo "</table>";
mysql_close($con);
?>
Database name: check_in
tables: visitor 1
fields: Name , Contact_Number ,Date,Time_In
Database name: check_out
tables: visitor 2
fields: Name , Contact_Number ,Date,Time_Out
Here is my HTML coding I couldnt attach becuase .html file cannot be uploaded
<html>
<head>
<title>report</title>
</head>
<body>
<br><br>
<pre>
<form action="abc.php" method="post">
From: <input type="text" Size="30" MAXLENGTH="10" Value="" name="from"/> To: <input type="text" Size="30" MAXLENGTH="10" Value="" name="to"/>
<input type="submit" value="Submit"/>
</pre>
</form>
</body>
</html>
Thanks in advance for the Help!!!!