samedi 23 mai 2015

2 or 3 Categorys search checkbox php

Each Article can have unlimited categories. Categories are saved in the database like this example article_category: '1','3','8' OR example article_category: '2','3' So when I search for a listing under, lets say category 3

$category_id = '1,3';

$SQL = "SELECT * FROM ARTICLES WHERE article_category = '$category_id'";

If it were just one the above would work fine. I hate to say it but I'm completely lost.. Would I use IN ?




Aucun commentaire:

Enregistrer un commentaire