Changeset 4272 for OpenPNE/trunk/webapp/lib/db/commu.php
- Timestamp:
- Oct 3, 2007, 8:02:58 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
OpenPNE/trunk/webapp/lib/db/commu.php
r4127 r4272 1710 1710 $select = 'SELECT c_commu.*'; 1711 1711 1712 $where = ' WHERE true';1712 $wheres = array(); 1713 1713 $params = array(); 1714 1714 if ($c_commu_category_id) { 1715 $where .= ' ANDc_commu.c_commu_category_id = ?';1715 $wheres[] = 'c_commu.c_commu_category_id = ?'; 1716 1716 $params[] = $c_commu_category_id; 1717 1717 } … … 1721 1721 $word = check_search_word($word); 1722 1722 1723 $where .= ' AND(c_commu.name LIKE ? OR c_commu.info LIKE ?)';1723 $wheres[] = '(c_commu.name LIKE ? OR c_commu.info LIKE ?)'; 1724 1724 $params[] = '%'.$word.'%'; 1725 1725 $params[] = '%'.$word.'%'; 1726 1726 } 1727 } 1728 if ($wheres) { 1729 $where = ' WHERE ' . implode(' AND ', $wheres); 1730 } else { 1731 $where = ''; 1727 1732 } 1728 1733 … … 1799 1804 $sql = 'SELECT * FROM c_commu'; 1800 1805 1801 $where = ' WHERE true';1806 $wheres = array(); 1802 1807 $params = array(); 1803 1808 if ($search_word) { 1804 $where .= ' AND(name LIKE ? OR info LIKE ?)';1809 $wheres[] = '(name LIKE ? OR info LIKE ?)'; 1805 1810 $params[] = '%'.$search_word.'%'; 1806 1811 $params[] = '%'.$search_word.'%'; 1807 1812 } 1808 1813 if ($c_commu_category_id != 'all' && $c_commu_category_id) { 1809 $where .= ' ANDc_commu_category_id = ?';1814 $wheres[] = 'c_commu_category_id = ?'; 1810 1815 $params[] = intval($c_commu_category_id); 1816 } 1817 if ($wheres) { 1818 $where = ' WHERE ' . implode(' AND ', $wheres); 1819 } else { 1820 $where = ''; 1811 1821 } 1812 1822
Note: See TracChangeset
for help on using the changeset viewer.