I queried a datbase based on user data after they signed up. The use data was assigned to session variable.
$result = mysqli_query($con, "SELECT * FROM `user` WHERE `id` ='".$_SESSION['id']."' ");
I assigned a value to $country from the lopp like this
while ($row = mysqli_fetch_array($result)) {$country= $row['country']; }
$country =$SESSION[`country`];
The page was redirecte. On another page, I used $country to query anothe table called market. The column is a varchar . The value $country was echoed but not performing this query below. It does nothing on ipage server but worked in localhost. The code is working on localhost but not on ipage cpanel server. Here is the code.
$result = mysqli_query($con, âSELECT name FROM market WHERE country =ââ.$country."â ");
while ($row = mysqli_fetch_array($result)) {echo $row[ânameâ]."
"; }
. It does not work on ipage server to query the name column from market table. It worked on my wamp.
WHAT I TRIED
(1)When I tried to Assign Id, which is an integer, into the variable, it worked both on server and localhost. It means something like this query out
$SESSION['id']= row['id'],
$id =$SESSION['id'],
SELECT * FROM market WHERE country = '$id'
(2)
Someone suggested I used cookies, same problem occurred
(3) the echoing of $country worked both on server and localhost. The problem is it is not querying on WHERE CLAUSE.