So, I wanted to use two params on the url to query from my server but I'm not being able to do it.
The url is : localhost/database/getTable?sLang=English&sId=1
The php Script is:
<?php
if(isset($_REQUEST['sLang']))
if(isset($_REQUEST['sId']))
{
$con = mysql_connect("blabla","blablabla","blablabla");
mysql_query("SET NAMES UTF8");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("database", $con);
$sLang = $_REQUEST['sLang']; //valor customer ID = valor requisitado
SdID = $_REQUEST['sID']
$result = mysql_query("SELECT * FROM table WHERE language = '$sLang' AND id = '$sId" ) or die('Errant Query:'); //escolher da tabela comments onde valor da coluna id = Valor reuisitado
while($row = mysql_fetch_assoc($result))
{
$output[]=$row;
}
header('content-type: application/json; charset=utf-8');
print(json_encode($output, JSON_UNESCAPED_UNICODE));
mysql_close($con);
}
else
{
$output = "not found";
print(json_encode($output));
}
?>
I'm just returning the sLang Values and the url changes to : localhost/database/getTable?sLang=English
How can I query the database using the two params sLang and sId?
Best regards