Ok lets assume that your address is this:
http://www.myclasspage.com/file.php?classyear=1990,1991,1992
In this instance just putting $classyear into the IN clause of your query will work just fine since it is formatted properly.
$query = "SELECT * FROM alumni WHERE classyear IN ($classyear)";
$result = mysql_query ($query);
-- In my first example $list was just a varible that represented the comma separated list of years, you could have just put $classyear in the query like I did above. And the beauty of using IN is that putting a single value between the quotes is valid syntax.
Now if you want to do the same thing with state you either need to make your link call your page like so:
http://www.myclasspage.com/file.php?state='NY','MA','PA'
Or you will have to parse what comes in the URL and build your string.
// Assuming that $state will hold NY,MA,PA no spaces no quotes
$state_array = [man]explode[/man](",",$state); // Make an array of states
$states = ""; // Blank states variable
$sep = ""; // setting up the separater character
// Loop through states array and build quote comma separated list
for (reset($state_array); $key = key($state_array); next($state_array) {
$state .= $sep . "'" . $states[$key] . "'";
$sep = ",";
}
$query = "SELECT * FROM alumni WHERE state IN ($states)";
$result = mysql_query ($query);
Now this code is more involved but it will basically take a list of comma separated values and build a single quote comma separated list of values. i.e NY,MA,PA to 'NY','MA','PA'
The explode function generates an array from a string and a delimiter. Then we walkthrough the array building our new string. The .= opperater is the same as saying $states = $states . "Something", the . being the concat opperator in PHP.