mysql sorgu sorunu

0 Cevap php

Benim masa "info" dört sütun adı, enlem, boylam ve dosya vardır. Ben adınızı, enlem ve boylam kombinasyonları verilen bir grubu için özel bir dosya almak için android (istemci) bir istek yolluyorum, burada istek işleyen kod php (sunucu tarafı) olduğunu ...

mysql_connect("localhost", "bb", "707") or die(mysql_error());
mysql_select_db("test1") or die(mysql_error());

$usrnm = $_REQUEST["username"];
$lat = $_REQUEST["lat"];
$lng = $_REQUEST["lng"];

$query = sprintf("SELECT filename FROM info WHERE username = '%s'"
   ,mysql_real_escape_string($usrnm)
   ,"AND latitude = %s",mysql_real_escape_string($lat)
   ,"and longitude = %s",mysql_real_escape_string($lng));

$result = mysql_query($query)
or die(mysql_error());  

$row = mysql_fetch_array( $result );

echo $row["filename"];

here is the issue : if I use the above query, the filename being returned is based only on the username and the latitude and longitudes are not considered. in brief only the first "name=value" pair after the where clause is used for getting the filename...why is that??? Is the query wrong or is there someother way to do this.... I am using MYSQL

Bir daha gözlem: Ben adınızı, enlem ve boylam değerlerini kodlamalısınız o zaman doğru dosya dönüyor ...

0 Cevap