Hey guys,
I saw a post in here the other day that's prompted me to ask this
question... Because I can't seem to get the solution mentioned to work.
Maybe I'm missing something obvious... Anyway, here goes.
I have a list of categories contained in one table, and a list of entries in
another. So
categories:
id name
1 category1
2 category2
3 category3
At the moment, the entries table has a field which contains a field
mentioning the category by id, so:
entries
id cat_id name
1 1 name1
2 1 name2
3 1 name3
The problem is this: I'd like to give some entries more than one category.
I attempted to put the category id's into an array. So a row in the revised
entries table now looks like this:
entries
id cat_id name
1 2 name1
2 1,3 name2
3 1 name3
And I'm trying to list from that table with code similar to this:
<?
$cat[0] = 1;
$cat[1] = 3;
$getcats = implode(",", $cat);
$query = @mysql_query("SELECT * FROM entries WHERE cat_id IN($getcats)")
or die (mysql_error());
// Get the results
?>
I get no errors when executing that code, but I don't get any results back,
either...... even though I know there are entries in the table with the
category id listed as 1,3
Any ideas? I'm having "one of those days" :)
Cheers,
James.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]