I have a table1 named 'residencial' and table2 named 'propert_data'.
In 'residencial' table, I have a column named 'main_cat' which can have 3 values i.e 'Residential', 'Commercial' and 'Land'.
I have 2 web services named commercial_data.php and residential_data.php
1) commercial_data.php:
<?php
require 'include/connection.php';
$sql="SELECT * FROM residencial INNER JOIN propert_data ON propert_data.r_id = residencial.pid WHERE residencial.main_cat= 'Commercial' AND propert_data.meta_key = 'slider_images'";
$rows = array();
$result = mysqli_query($conn, $sql);
while($row = mysqli_fetch_assoc($result)) {
array_push($rows,$row);
}
$myJson = json_encode($rows);
echo $myJson;
?>
Output of this is perfect.
2) residential_data.php:
<?php
require 'include/connection.php';
$sql="SELECT * FROM residencial INNER JOIN propert_data ON propert_data.r_id = residencial.pid WHERE residencial.main_cat= 'Residential'
AND propert_data.meta_key = 'slider_images'";
$rows = array();
$result = mysqli_query($conn, $sql)or die(mysqli_error($conn));
while($row = mysqli_fetch_assoc($result)) {
array_push($rows,$row);
}
$myJson = json_encode($rows);
echo "Data:". $myJson;
?>
Output of this is: Data:
The only difference in two file is:
In file 1, I have: residencial.main_cat = 'Commercial'
In file 2, I have: residencial.main_cat = 'Residential'
What could the problem be?