Hi! I am getting message #1052 - Column 'userlevel' in where clause is ambiguous while running following query:
<?PHP
$query=mysql_query("SELECT mssgs.start_date, mssgs.task, mssgs.status, mssgs.timestamp, mssgs.due_on, mssgs.id, users.fname FROM mssgs
INNER JOIN users ON mssgs.uid=users.uid AND mssgs.userlevel=users.userlevel WHERE status=0 AND userlevel=1 OR userlevel=3");
if(mysql_num_rows($query) > 0)
{
while($row=mysql_fetch_array($query))
{
if($row!=0)
{
$id=$row['id'];
$userlevel=$row['userlevel'];
if($userlevel==1)
{
$userlevel="Manager";
}
elseif($userlevel==2)
{
$userlevel="Administrator";
}
elseif($userlevel==3)
{
$userlevel="Programmer";
}
elseif($userlevel==12)
{
$userlevel="Business Dev. Officer";
}
elseif($userlevel==31)
{
$userlevel="Marketing Executive";
}
echo "<tr align='center'>
<td class='style3'>"; echo $row['fname']; echo "</td>
<td class='style3'>"; echo $userlevel; echo "</td>
<td class='style3'>"; echo $row['task']; echo "</td>
<td class='style3'>"; echo $row['start_date']; echo "</td>
<td class='style3'>"; echo $row['due_on']; echo "</td>
</tr>";
}
}
echo "</table>";
}
?>