i have 3 tables i want to show the data from them to a page.
table1 "trip"
table2 "seat"
table3 "user_information"
show all the data of table one which is working its showing but how can i show multiple table data any ways.
show all data of trip and seat
from user_information it shows
first_name
last_name
all the tables have id with the same name.
here is the code im using.
<?php
$con = mysql_connect("localhost","root","password");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("online_bus_project", $con);
$result = mysql_query("SELECT * FROM trip, seat, user_information ORDER BY `id` DESC LIMIT 1");
echo "<table border='1'>
<tr>
<th>First Name</th>
<th>Last Name</th>
<th>From</th>
<th>To</th>
<th>Date</th>
<th>Fare</th>
<th>Seat</th>
</tr>";
while($row = mysql_fetch_array($result))
{
echo "<tr>";
echo "<td>" . $row['first_name'] . "</td>";
echo "<td>" . $row['last_name'] . "</td>";
echo "<td>" . $row['from'] . "</td>";
echo "<td>" . $row['to'] . "</td>";
echo "<td>" . $row['date'] . "</td>";
echo "<td>" . $row['fare'] . "</td>";
echo "<td>" . $row['seat'] . "</td>";
echo "</tr>";
}
echo "</table>";
mysql_close($con);
?>