1
I have a table in my database with:
horarioIdhorarioParagemIdhorarioLinhaIdhorarioHora
Do INNER JOIN of the table rows:
linhaIdlinhaNome
Do INNER JOIN of the table stops:
paragemIdparagemRuaparagemLatitudeparagemLongitudeExample of the schedule table
Horarioid : 1 scheduleParagemId : 3 hourly Table : 4 hourly Time :22:00:00
Horarioid : 2 scheduleParagemId : 3 hourly Table : 4 hoursHora :21:00:00
The goal is to only receive the coordinates where the id of the stops are different. The code I made works with paragemLatitude or paragemLongitude, but does not work with paragemId
include_once('seguranca.php');
protegePagina();
$sql="SELECT DISTINCT horarioParagemId
FROM horarios
INNER JOIN paragens ON paragemId = horarioParagemId
INNER JOIN linhas ON horarioLinhaId = linhaId
WHERE horariolinhaId = " . $_GET['filtrapronto'];
$_SESSION['latitudefiltra']= array();
$_SESSION['longitudefiltra']= array();
$result=mysqli_query($con,$sql);
while($dados=mysqli_fetch_array($result)) {
$_SESSION['latitudefiltra'] [] = $dados['paragemLatitude'];
$_SESSION['longitudefiltra'] [] = $dados['paragemLongitude'];
}
$obj = new stdClass();
$obj->Latitudes=$_SESSION['latitudefiltra'];
$obj->Longitudes=$_SESSION['longitudefiltra'] ;
echo json_encode($obj);
You can illustrate the expected result?
– Marcelo de Andrade
This is what you want: http://sqlfiddle.com/#! 9/5535ec/4 ? If not, tell us an example of records you have and what result you expect.
– vmartins