Example DB structure (download table)
id | pid | title
----------------------------------------------------
1 | 3,4,5 | Download 3, Download 4, Download 5
----------------------------------------------------
2 | 3 | Download 3
----------------------------------------------------
Here is my code
<?php
$pid = explode(",", $order['pid']);
for($x = 0; $x < count($pid);){
if(count($pid) == 1 ) {
$thepid = 'pid="'.$pid[$x].'"';
} else {
$thepid = 'pid="'.$pid[$x].'" OR ';
}
$x++; }
$select = 'SELECT * FROM download WHERE '.$thepid.'';
$query = $db->rq($select);
while($download = $db->fetch($query)) {
?>
Question -
- How to make the
$select
can readpid="3" OR pid="4" OR pid="5"
ifcount($pid)
more than one.
I know the table structure is not normal. But how possible to get it works.