06-06-2008, 04:24 PM
|
#3 (permalink)
|
|
The Contributor
Join Date: Jan 2008
Location: Maine, USA
Posts: 92
Thanks: 2
|
One thing that you could do is take your array and implode it into a string.
php Code:
$strcat = implode(', ', $arrcat); // For example say you have a sample array // that looks like this:// $arrcat = array(1, 3, 5);// The first step will take the array // and implode it into $strcat like so:// $strcat = '1, 3, 5';
Then use that string in the query for the criteria (Note the use of the IN keyword:
php Code:
$sql = 'SELECT PO.strTitle, PO.bFeatured, PO.strPreview, PO.strFile, PO.dateCreated AS tsCreated, DATE_FORMAT(PO.dateCreated, '%b, %D %Y %l:%i %p') AS dateCreated, PO.nPostId, PO.nPostType, PO.strPost, PO.strAbout, PO.nViews, CA.strCategory, CA.nCategoryId, CA.nParentCategoryId FROM tblposts PO INNER JOIN tblcategories CA ON CA.nCategoryId = PO.nCategoryId WHERE CA.nCategoryId IN ('.$strcat.') AND PO.bFeatured = 1';
__________________
-- Bill
"Why is it drug addicts and computer aficionados are both called users?" -Clifford Stoll
Last edited by buggabill : 06-06-2008 at 04:25 PM.
Reason: One little 'n'...
|
|
|
|