$LOC_DEBUG = false; /* Make sure we have a DB connection (harmless if already included) */ if (!isset($GLOBALS['con']) && !isset($GLOBALS['conn'])) { if (file_exists(__DIR__ . '/dbconfig.php')) require_once __DIR__ . '/dbconfig.php'; } /* ---------- read back the current selection ---------- */ function cl_first($key) { if (!isset($_GET[$key])) return ''; $v = $_GET[$key]; if (is_array($v)) $v = reset($v); return trim((string)$v); } $curCategory = cl_first('category'); // "Commercial Property" $curBudget = cl_first('budget'); // "2500000-3000000" $curBhk = cl_first('bhk'); // "2 BHK" $curLocations = []; if (!empty($_GET['search'])) { foreach (explode(',', $_GET['search']) as $l) { $l = trim($l); if ($l !== '') $curLocations[] = $l; } } /* ---------- options (defined once) ---------- */ $tabs = [ '' => ['label' => 'All', 'icon' => 'fa-home'], 'Plot' => ['label' => 'Plots / Land', 'icon' => 'fa-seedling'], 'Apartment' => ['label' => 'Apartments', 'icon' => 'fa-building'], 'Independent House' => ['label' => 'Ind. Houses', 'icon' => 'fa-home'], 'Commercial Property' => ['label' => 'Commercial', 'icon' => 'fa-store'], 'Farming Land' => ['label' => 'Farming Land', 'icon' => 'fa-tractor'], ]; $budgets = [ '' => 'Any Budget', '500000-1000000' => '5 - 10 L', '1000000-1500000' => '10 - 15 L', '1500000-2000000' => '15 - 20 L', '2000000-2500000' => '20 - 25 L', '2500000-3000000' => '25 - 30 L', '3000000-4000000' => '30 - 40 L', '4000000-5000000' => '40 - 50 L', '5000000-7000000' => '50 - 70 L', '7000000-10000000' => '70L - 1Cr', '10000000-999999999' => '1 Cr & Above', ]; $bhks = ['' => 'All BHK', '1 BHK' => '1 BHK', '2 BHK' => '2 BHK', '3 BHK' => '3 BHK', '4 BHK' => '4 BHK']; /* ---------- LOCATIONS FROM THE DATABASE ---------- */ $chennaiAreas = []; $locNote = ''; /* 1. find the connection, whatever dbconfig.php called it */ $db = null; foreach (['con', 'conn', 'mysqli', 'db', 'link'] as $v) { if (isset($GLOBALS[$v]) && $GLOBALS[$v] instanceof mysqli) { $db = $GLOBALS[$v]; break; } } if (!$db) { $locNote = 'No mysqli connection found — include dbconfig.php before search-filter.php'; } else { /* 2. find the table (you've written it both ways) */ $LOC_TABLE = ''; foreach (['pro_location', 'pro_locationn'] as $t) { $chk = $db->query("SHOW TABLES LIKE '" . $db->real_escape_string($t) . "'"); if ($chk && $chk->num_rows > 0) { $LOC_TABLE = $t; break; } } if ($LOC_TABLE === '') { $locNote = 'Table pro_location / pro_locationn not found'; } else { /* 3. find the column holding the name */ $cols = []; if ($r = $db->query("SHOW COLUMNS FROM `$LOC_TABLE`")) { while ($row = $r->fetch_assoc()) $cols[] = $row['Field']; } $LOC_COL = ''; foreach (['location', 'name', 'area', 'locate', 'locality', 'title', 'loc_name', 'pro_location'] as $c) { if (in_array($c, $cols, true)) { $LOC_COL = $c; break; } } if ($LOC_COL === '') { // fallback: first column that isn't an id foreach ($cols as $c) { if (stripos($c, 'id') === false) { $LOC_COL = $c; break; } } } if ($LOC_COL === '') { $locNote = "No usable column in `$LOC_TABLE`. Columns: " . implode(', ', $cols); } else { /* 4. pull the list */ $sql = "SELECT DISTINCT `$LOC_COL` AS v FROM `$LOC_TABLE` WHERE `$LOC_COL` IS NOT NULL AND TRIM(`$LOC_COL`) <> '' ORDER BY `$LOC_COL` ASC"; if ($r = $db->query($sql)) { while ($row = $r->fetch_assoc()) { $val = trim($row['v']); if ($val !== '') $chennaiAreas[] = $val; } $locNote = "OK — `$LOC_TABLE`.`$LOC_COL` gave " . count($chennaiAreas) . " locations"; } else { $locNote = 'Query failed: ' . $db->error; } } } } if ($LOC_DEBUG) { echo '
'
       . htmlspecialchars($locNote) . "\n\n"
       . htmlspecialchars(print_r(array_slice($chennaiAreas, 0, 15), true))
       . '
'; } ?> ThakkolamTown
Chennai Land — find your best property in Chennai

Properties in Thakkolamtown

PLOT SIZE SQ.FT PRICE PLOT PRICE
600 750 4.5L*
800 750 6L*
1000 750 7.5L*
1200 750 9L
2400 750 18L

21 Acres Mega Gated community Villa Plots – 600 units •   ...Read More

₹4.5L* By Karthick / Darvesh Realtor
Enquire Now

FAQ

test for that

Sai Skanda Paradise
Royal Garden

Enquiry Form:-

KVT Smart City