Hello,
i have the following script that queries the table for a record count with a specific id:
try
{ $stmtS = $DBH->query("SELECT count(*) as counted
FROM tbl_table1
WHERE category = $catID and status = 1");
$recordCount = $stmtS->fetchColumn();
} catch(PDOException $e) { echo 'display error 1: ' . $e->getMessage(); }
Question:
I need to query the table for a record count with multiple ids. so my question is,
how do i query without using multiple “ORs” in a mysql statement. looking at the example
above, is there a way to replace $catID with an array containing the catids to search?
example array:
Array
(
[0] => 141
[1] => 142
[2] => 143
[3] => 144
[4] => 145
[5] => 146
[6] => 147
[7] => 148
[8] => 149
[9] => 150
[10] => 151
[11] => 152
)