How is it possible to select the first column in the Where clause
. I am trying to make a php
function to retrieve table data based on the id
, yet since the titles of the id
columns are different in various tables, I need to refer to the first column in the Where clause as the first column is always the id column.
The scenario would be something like the following, but it throws errors and says that there is an error in the SQL syntax.
$stmt = $this->conn->prepare("SELECT * FROM $table WHERE column(1) = :id");
Thanks in advance.