I have designed a simple relational database. When I am trying to get the data from the server it is throwing an error: (I have skipped some code to make it simple)
This is the SQL syntax I am using:
$sql = "SELECT lead.id, lead.name, lead.phone, lead.email, treatment.name, source.name, status.name FROM lead join treatment join source join status on treatment.id = lead.treatment_id and source.id = lead.source_id and status.id = lead.status_id";
This is used inside HTML:
echo "
<tr>
<td>".$row["lead.id"]."</td>
<td>".$row["lead.name"]."</td>
<td>".$row["lead.email"]."</td>
<td>".$row["treatment.name"]."</td>
<td>".$row["source.name"]."</td>
<td>".$row["status.name"]."</td>
</tr>";
This code is giving an error, when I change $row["lead.id"] to $row["id"]
it works but I need to mention the table name as I have same column names in almost all the tables.
is there any way to do it using the table name?
</div>