请有人帮助我。我的代码有问题,错误说
您的 SQL 语法有错误;检查与您的 MySQL 服务器版本相对应的手册,以了解在第 1 行“经度=”附近使用的正确语法。
这是我的代码:
<?php
include 'connect.php';
$id=isset($_SESSION['id']);
$sql = mysql_query("SELECT sms_text FROM sms_in where id = '$id'") or die(mysql_error());
$gps= mysql_fetch_array($sql);
preg_match('/lat:(\d+\.\d+) /', $gps, $matches);
unset($matches[0]);
$params = array(
'f' => 'q',
'q' => implode(',', $matches),
'z' => 16,
);
$query1 = '//maps.google.com/maps?' . http_build_query($params);
$query = array();
$urlParts = parse_url($query1);
parse_str($urlParts['query'], $query);
//echo $query['q'];
//Get longitude
$sql4 = mysql_query("SELECT sms_text FROM sms_in where id = '$id'") or die(mysql_error());
$gps1= mysql_fetch_array($sql);
preg_match('/long:(\d+\.\d+) /', $gps1, $matches1);
unset($matches1[0]);
$params1 = array(
'f' => 'q',
'q' => implode(',', $matches1),
'z' => 16,
);
$query2 = '//maps.google.com/maps?' . http_build_query($params1);
$query3 = array();
$urlParts1 = parse_url($query2);
parse_str($urlParts1['query'], $query3);
//echo $query3['q'];
//$sql5="select id
---> //这是错误的原因
$sql2= mysql_query("Insert into tbl_location SET latitude=$query[q],longitude=$query3[q]")
or die(mysql_error());
?>
谢谢!