Is there a way to call a variable field name in a select query? Here's an example - normally I'd call something like $sql = "SELECT * FROM $table_name WHERE type = '$class_type'"; but can I reverse that somehow and say (for lack of a better way) WHERE '$platform' = yes? $platform is passed from a previous page and is the name of a db field in my database. I've tried it like this but to no avail...
$sql = "SELECT * FROM $table_name WHERE type = '$class_type' AND '$platform' = yes ORDER BY version";
Thanks
Try: $sql = "SELECT * FROM $table_name WHERE type = '$class_type' AND $platform = 'yes' ORDER BY version";
well, i didn't try this but i would assume it would look like this:
$sql = "select * from $table_name where type = '$class_type' && $platform = 'yes'";
just adjust your single quotes.