I have two tables currencies and markets, I want to use id, last, volume, bid, trade_status from markets table and only Symbol from currencies table.
when I using the bellow code as I have volume and id in both tables, that is multiply times showing
<?php
$con = mysqli_connect("localhost","Dotland","passwd","Dotland");
$response = array();
if($con){
$sql = "select * from markets, currencies";
$result = mysqli_query($con,$sql);
if ($result){
header("content-Type: JSON");
$i=0;
while($row = mysqli_fetch_assoc($result)){
$response[$i]['id'] = $row ['id'];
$response[$i]['symbol'] = $row ['symbol'];
$response[$i]['last'] = $row ['last'];
$response[$i]['volume'] = $row ['volume'];
$response[$i]['bid'] = $row ['bid'];
$response[$i]['trade_status'] = $row ['trade_status'];
$i++;
}
echo json_encode($response,JSON_PRETTY_PRINT);
}
}
else{
echo "Database Connection Failed";
}
?>