I have created a database named (insert) having two tables table1 and table 2.
table1
have 3 columns user, id, roll
.
table2
have 2 columns id, menu
.
I have inserted values in two tables. I want to retrieve all values from two tables and show them in another php file, but my query is not working. It's showing error. What should I do? here is my code
<?php
include 'insertjoincon.php';
$sql = "SELECT table1.user, id FROM table1, table2 WHERE table1.id=table2.id";
echo "<table border=1>
<tr><th>Name</th><th>ID</th></tr>
";
while ($line = mysql_fetch_array($sql)) {
$name = $line["user"];
$id = $line["id"];
echo "<tr>";
echo "<td>" . $name . "</td>";
echo "<td>" . $id . "</td>";
echo "</tr>";
echo "</table>";
}
$conn->close();
?>