Jump to content

WHERE IN problem


mapleleaf

Recommended Posts

I am trying to check if an id is in a comma separated string in the database

 

I was using this:


$query = "SELECT * FROM articles ";
$query .= "WHERE second_theme
			IN ( ".$_POST['secondary_theme']." ) ";

 

$_POST['secondary_theme'] is an id and second_theme is the comma separated list.

What seems to be happenning is that if the id is the first in the comma separated list it will return it. If 2nd or 3rd it won't be returned?

 

Did I misunderstand WHERE IN??

 

 

 

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/186955-where-in-problem/
Share on other sites

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.