Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //TV FILTERS
- $sql = 'SELECT * FROM `table1`';
- $where = array();
- if ($searchlocation !== 'Any') $where[] = '`value` LIKE "%'.$searchlocation.'%"';
- if ($searchmake !== 'Any') $where[] = '`value` LIKE "%'.$searchmake.'%"';
- if ($searchtype !== 'Any') $where[] = '`value` LIKE "%'.$searchtype.'%"';
- if (count($where) > 0) {
- $sql .= ' WHERE '.implode(' OR ', $where);
- } else {
- // Error out; must specify at least one!
- }
- $tvqresult = mysql_query($sql);
- $num_rowstvq = mysql_num_rows($tvqresult);
- while ($rowtvq = mysql_fetch_array($tvqresult)) {
- $contid = $rowtvq['contentid'];
- //MAIN QUERY
- $mainsql = 'SELECT * FROM `table2` WHERE `content` LIKE "%' . $searchterm . '%" AND `id` = ' . $rowtvq['contentid'] . ' AND `template` = 12';
- $resultmain = mysql_query($mainsql);
- $num_rowsmain = mysql_num_rows($resultmain);
- if (!$resultmain) {
- continue;
- }
- else {
- while ($row = mysql_fetch_array($resultmain )) {
- echo "[!Ditto? &parents=`134` &documents=" . $row['id'] . "&tpl=`usedtempchunk`!]";
- }//END MAIN LOOP
- }//END MAIN ELSE
- }//END TV WHILE LOOP
- $sql = 'SELECT distinct contentid FROM `table1`'; // rest would be the same
- $sql = 'SELECT distinct contentid, contentTitle, contentThing FROM `table1`';
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement