Jump to content

Including array in SQL IN


padams

Recommended Posts

I'm trying to use the SQL IN command when I query my mySQL database, but the value I am sending in it is an array, created when users selected multiple options in a list. I've been looking around and have seen a few possible solutions involving SQL, but I'm relatively new to PHP and SQL and am not quite sure how to resolve this. Any ideas?

 

matchTeam is the array:

 

$players = $_POST['matchTeam'];

$playerGames = "SELECT * FROM players WHERE playerID IN ($players)";

$playerGames_query = mysql_query($playerGames) or die(mysql_error());

$rsPlayerGames = mysql_fetch_assoc($playerGames_query);

 

Link to comment
https://forums.phpfreaks.com/topic/65669-including-array-in-sql-in/
Share on other sites

$players comes from a list where users can select multiple values. The list is created dynamically and is made up of the first and last names of players belonging to our club. You can see the page at http://www.otterstouch.com/ottersdb/select3.php. It's ugly I know!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.