目前我有一个多对一的关系,我需要我的地图查看器来显示所有子记录,而不仅仅是最后一条记录。我进行了研究,发现可能我可以重新重写变量,这就是为什么最后一条记录是唯一显示的。我进行了测试以确保所有记录实际上都是通过使用提琴手来实现的。请帮忙。
请参阅下面的 PHP 代码
<?php error_reporting(E_ERROR | E_WARNING | E_PARSE);
$pole = $_GET["pole"];
// Connect to SQL Server database
include("../connections/PubgisConnect.php");
// Construct query
$tsql = "Select [dbo].[TRANS_POLE].[PoleID], [dbo].[TRANS_POLE].[PoleType], [dbo].
FROM [pubgis].[dbo].[TRANS_POLE]
INNER JOIN [pubgis].[dbo].[TRANS_SIGN] ON [pubgis].[dbo].[TRANS_POLE].[PoleID][pubgis] [dbo].[TRANS_SIGN].PoleID INNER JOIN [pubgis].[dbo].[TRANS_SIGNINSPECTION] ON [pubgis].[dbo].[TRANS_SIGN].SignID = [pubgis].[dbo].[TRANS_SIGNINSPECTION].SignID
WHERE [pubgis].[dbo].[TRANS_POLE].[PoleID] = '$pole'";
// Execute query
$stmt = sqlsrv_query( $conn, $tsql);
if( $stmt === false )
{
echo "Error in executing query.</br>";
die( print_r( sqlsrv_errors(), true));
}
$results = array();
// Retrieve and display the results of the query
$lastFeatType = "";
while($row = sqlsrv_fetch_array($stmt,SQLSRV_FETCH_ASSOC)) {
array_push($results,$row);
}
echo json_encode($results);
// Free statement and connection resources
sqlsrv_free_stmt( $stmt);
sqlsrv_close( $conn);
?>
下面的代码来自我的索引文件
dojo.xhrGet({
url: "StreetSignsProfile.php",
handleAs: "json",
content:{pole: pole},
load: function(data) {
for (var i=0;i<data.length;i++) {
var obj = data[i];
var pole = obj["PoleID"];
var encodedPole = encodeURIComponent(pole);
var na = "<span class='notAvail'>not available</span >";
dojo.byId("idHeader").innerHTML = obj["PoleID"];
dojo.byId("PoleType").innerHTML = obj["PoleType"];
//Sign Code
dojo.byId("SignID").innerHTML = obj["SignID"];
dojo.byId("SignCode").innerHTML = obj["SignCode"];.
查看以上结果 极点信息 极点类型