Aycko Maerzke wrote:
I tried an query like this:
$db->query("SELECT `:tablename:filedname` FROM `table`");
You shouldn't use parameters for table and column names. Parameters are
used in SQL only to supply values, not identifiers or any other part of
syntax.
Also, the identifier delimiter syntax you used above won't work even if
you execute it in the MySQL command-line client. You need to do the
delimiters on _each_ of the table name and the column name.
For example, the following doesn't work because it looks for a column
called foo.bar in the table foo.
SELECT `foo.bar` FROM `foo`
You need to delimit each identifier separately to make it clear that
they are two separate identifiers:
SELECT `foo`.`bar` FROM `foo`
If you need to make the table referenced in the select-list depend on
the table queried in the FROM clause, you should use a correlation name:
SELECT f.`bar` FROM `foo` AS f
Regards,
Bill Karwin