如何使用Recordset中的条目作为MYSQL查询中的条件

I've been experimenting with PHP for the first time so I hope this isn't an obvious question. I have two tables in a database, one is called users the other is called articles. In the users table there is a field which contains the categories that the user wants to follow. Using a recordset in Dreamweaver I can get the information for the current user through a recordset. This done in the code below.

'$row_UserDets['CatFollow']'

At the moment there are comma separated values in the field however I can change this. I now want to search the Article Table's Category Field and return all results with the those categories. So far I've tried this.

$query_usernews = "SELECT * FROM Articles WHERE CategoryOne IN ($row_UserDets['CatFollow']); $usernews = mysql_query($query_usernews, $database name) or die(mysql_error());

I hope that makes sense. I've tried it a few times in a number of different formats. As I've said I'm new to this and I might have been going about it completely the wrong way. man Thanks for your time.

Try something like:

$query_usernews = "SELECT * FROM Articles WHERE CategoryOne IN ({$row_UserDets['CatFollow']})";

Or simply:

$query_usernews = "SELECT * FROM Articles WHERE CategoryOne IN (" . $row_UserDets['CatFollow'] . ")";

As Romain stated in the comment, you need to SQL Injection proof your code (mysql_real_escape, or PDO + Prepared statements).