MySQL using SELECT WHERE Primary Key = XYZ

Viewed 14268

Is it possible to use "Primary Key" instead of a column in a SELECT * WHERE query in MySQL?

Example situation:

table1:
name (P) | surname

table2:
page (P) | content

I have tried (PHP)

SELECT * FROM $table WHERE PRIMARY=$row

and nothing has been returned (despite PHPMyAdmin highlighting it).

I want to do this because I want to make a getDbData function where I only need to specify the table ($table) and the row ($row, row name is primary key's value) for it to return the single row I need.

1 Answers
Related