Run a SQL query based on HTML drop down selection?



This is my HTML form:

<form method=get action="home.php">
<INPUT TYPE = "Text" VALUE = "" NAME = "title"><br>
<select name="searchby">
<option value="Title">Title</option>
<option value="Year">Year</option>
<option value="Genre">Genre</option>
<option value="Director">Director</option>
</select>

And here is the relevant PHP query:

$query = "SELECT Title, ReleaseYear, Rating, Director, RunningTime,
Genre
FROM movie
WHERE $searchby LIKE '%$title%'
GROUP BY $searchby";

Assume that "$title" is a string of text (not necessarily a movie
title). My problem seems to be that I cant use the variable $searchby
within a SQL query. Is there a workaround for this?
.



Relevant Pages

  • Re: Creatinig a database to update in alphabetical order
    ... You can then create a Query which takes all of the records in the ... Some attributes of a movie would be the Title, the studio, ... MovieID Autonumber Primary Key ' links tables together ... Keyword ...
    (microsoft.public.access.gettingstarted)
  • Re: Creatinig a database to update in alphabetical order
    ... John M. it is like you are reading my mind, ... know I am a movie fanatic. ... > should not be routine) displayed as a query datasheet. ... > Keyword ...
    (microsoft.public.access.gettingstarted)
  • Re: Undocumented Filter?
    ... I think Tom was referring to the same movie I was, "Army of Darkness," ... I currently re-mask the SQL of the source query by taking a query I've set ... That solution gives me a Filter property for the query (since I'm working ... > That was not Bruce Campbell, ...
    (microsoft.public.access.modulesdaovba)
  • One To Many To One Common Problem
    ... This seems to be a perrenial problem with many database designs. ... Using a simple example of a movie database (but I have other ... foreign key for GENRE. ... The query that this is based on contains all the MOVIEGENRE records, ...
    (microsoft.public.access.forms)
  • Re: SQL Ignorance
    ... It's an informal home user record of his own movie watching ... He's asked me to write a particular query, ... (tblActor.ActorID in the Actor Table,) ... Shirley Temple, Clint Eastwood, Rowan ...
    (comp.databases.ms-access)