mysql - PHP Session Variable lost after click on page other category -


i have 1 site such olx.com used product buy , sell, index page has city filter drop down list, once user clicks filter see product filter city , redirect page city_filter.php till working, after city filter when user click on categories such computer or electronics user not found product, categories coming mysql database, city_filter.php included function_city.php calling function categories, please find city_filter.php function created on function_city.php follow:

function displaycomputer_city(){                  global $con;                 $get_cats = "select * categories categories_id = 1";                 $run_cats = mysqli_query($con, $get_cats);                  while ($row_cats=mysqli_fetch_array($run_cats)) {                  $computer_id = $row_cats['categories_id'];                 $computer_title = $row_cats['categories_name'];                       echo "<li><a href='city_filter.php?computer_cat=$computer_id'>$computer_title</a></li>";                  }           } 

on city_filter.php page, when click computer take on browser computer_cat=id , using mention function filter computer filter city

function getcomputerpro_city() {          global $con;         global $eu;         global $limit;            if(isset($_get['computer_cat'])){                             $cat_id = $_get ['computer_cat'];    $get_products = "select product_list.*, city1.* product_list inner join city1 on product_list.city_id=city1.city_id , product_list.city_id={$_sesseion['city_id']} , categories_id='$cat_id' limit $eu, $limit";  foreach ($con->query($get_products) $row) {  echo "<div class='ser-grid-list'> <h5>$row[product_title]</h5>     <img src='admin_area/product_images/$row[image_1]' width='160' height='110' alt=''>     <p>price : $row[currency] $row[product_price]</p>     <p>city : $row[city_name]</p>     <p>date : $row[date]</p>     <div class='btn top'><a href='details.php?pro_id=$row[list_id]'>view more</a></div> </div>"; }    }        }    

i think not going correct why, because noticed when click on computer categories takes computer_cat = id on receive using method, , once click categories city id session lost, don't practice type of situation.

if have included session_start(); in start of every page , if have not unset/destroyed sessions, have typo here:

change this:

$get_products = "select product_list.*, city1.* product_list inner join city1 on product_list.city_id=city1.city_id , product_list.city_id={$_sesseion['city_id']} , categories_id='$cat_id' limit $eu, $limit"; 

to this:

$get_products = "select product_list.*, city1.* product_list inner join city1 on product_list.city_id=city1.city_id , product_list.city_id={$_session['city_id']} , categories_id='$cat_id' limit $eu, $limit"; 

Comments

Popular posts from this blog

html - Firefox flex bug applied to buttons? -

html - Missing border-right in select on Firefox -

c# - two queries in same method -