I am getting confused with this. I have searched the internet and it is still confusing me. I have the following tables:
Meetings: meeting_id, title, chairman, secretary, occurances
Rooms: room_id, room, date, time, meeting_id
I want everything to be displayed on a table. My PHP is as follows:
<?php
$result = mysql_query("SELECT * FROM Meetings INNER JOIN Rooms ON meeting_id = Rooms.meeting_id")
or die(mysql_error()); ;
if (mysql_num_rows($result) == 0) {
echo 'There Arent Any Meetings Setup Yet';
} else {
echo "<table border='0'><table border width=100%><tr><th>Title</th><th>Chairperson</th><th>Secretary</th><th>Terms of Reference</th><th>Occurances</th><th>Room</th><th>Date</th><th>Time</th>";
while($info = mysql_fetch_array($result))
{
echo "<tr>";
echo "<td><br/>" . $info['title']." </td>";
echo "<td><br/>" . $info['chairperson']. "</td>";
echo "<td><br/>" . $info['secretary']."</td>";
echo "<td><br/>" . $info['tof']. "</td>";
echo "<td><br/>" . $info['occurances']. "</td>";
echo "<td><br/>" . $info['room']. "</td>";
echo "<td><br/>" . $info['date']. "</td>";
echo "<td><br/>" . $info['time']. "</td>";
}
}
echo "</tr>";
echo "</table>";
?>
It comes out with the following error message:
Column ‘meeting_id’ in on clause is ambiguous
I am trying to display all the fields from the meetings table and obviously the room, date and time only.
How do I fix this?
You need to define which table you want
meeting_idto be selected from.e.g.