I was tring to get values from mysql db and creating json from php. But am always getting "false" as reply.
My query is working correctly .
<?php
header("Content-type: text/html; charset=utf-8");
$servername = "localhost";
$username = "root";
$password = "root";
$dbname = "test";
$charset="UTF8";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sth = mysqli_query("select
a.id,
a.fname,
a.mname,a.lname,a.country,a.city,a.dob,a.role,
a.email,
b.mobile,b.skypeid,b.address,b.languages,
c.height,
c.width,
c.skin,
c.bust,
c.waist,
c.hips,
c.shoesize,
c.hair,
c.eye,
c.comments,
d.movie,
d.advertisement,
d.brandpromotional,
d.danceshow,
d.runway,
d.catalog,
d.editorial,
d.fit,
d.casual,
d.corporate,
d.swimwear,
d.fitness,
d.magazine,
d.lingerie,
d.glamour,
d.alternative,
d.hair,
d.legs,
d.hands,
d.webmodel,
d.social,
d.experience
from
basicinfo a
join contactdetails b
on a.email=b.email
join measurements c
on a.email = c.email
join areainterest d
on a.email=d.email
where a.role='Model'");
$rows = array();
while($r = mysqli_fetch_assoc($sth)) {
$rows[] = $r;
}
print json_encode($rows);
?>
please help me