我有一个表查询,它返回包含一些常见信息的结果。 还有一些数据是使用php从查询结果创建的。我希望能够选择所呈现的内容和订单。 我应该将结果存储在一个数组中,并在“foreach循环”之后显示它们。还是有更好的方法?
目前,每个返回的记录都会显示每行。 例如:
出现第1行:
Site (Name): ACT:CUST:PARL
CLLI (node code): 31B0
Family Name: Remote Studio
Region (state): ACT
Chassis: 01-31B0:P:ACT:cust:PARLIAMENT
Transmission Type: CPE
Vlan Number: 12
IP Address: 10.72.136.136
Multicast Address Range: 239.76.100.0/24
Location: 1 Capital, Capital Hill
Itam name / Itam Status 01-31b0-p-act-cust-parliament / Deployed
显示第2行:
Site (Name): ACT:cust:PARL
CLLI (node code): 31B0
Family Name: Remote Studio
Region (state): ACT
Chassis: 01-31B0:S:ACT:cust:PARLIAMENT
Transmission Type: CPE
Vlan Number: 13
IP Address: 10.72.137.8
Multicast Address Range: 239.76.100.0/24
Location: 1 Capital Circle, Capital Hill
Itam name / Itam Status 01-31b0-s-act-cust-parliament / Deployed
通缉演示:
(some other table data not developed yet)
Vlan Number: 12
Vlan Number: 13
Site (Name): ACT:CUST:PARL
CLLI (node code): 31B0
Family Name: Remote Studio
Region (state): ACT
Location: 1 Capital Circle, Capital Hill
Chassis: 01-31B0:P:ACT:CUST:PARLIAMENT
IP Address: 10.72.136.136
IP Address: 10.72.136.136
Multicast Address Range: 239.76.100.0/24
(some other data from another table/query)
Itam name / Itam Status 01-31b0-p-act-cust-parliament / Deployed
Itam name / Itam Status 01-31b0-s-act-cust-parliament / Deployed
显示代码:
foreach($rows as $row){
extract($row);
//Get Transmission Type
if ($systype >3){
$txtype="CPE";
$famname="Remote Studio";
}else{
$txtype="CORE";
$famname="Core";
}
//convert int to chg status
$getstatus=new functions();
$getstatus->obj="$ASSETLIFECYCLESTATUS";
$ASSETSTATUS=$getstatus->listchangestatus();
//Get state
$sarr=$fn->getnode($system_name);
#$var_dump($sarr);
$region=$sarr[3];
?>
<div class="row">
<div class="col-xs-6 col-sm-3 col-md-3 col-lg-9" >
<label>Site (Name): </label>
<span style="display:inline-block">
<?php echo "$site_id";?>
</span>
<br />
<label>CLLI (node code): </label>
<span style="display:inline-block">
<?php echo "$site_code";?>
</span>
<br />
<label>Family Name: </label>
<span style="display:inline-block">
<?php echo "$famname";?>
</span>
<br />
<label>Region (state): </label>
<span style="display:inline-block">
<?php echo "$region";?>
</span>
<br />
<label>Chassis: </label>
<span style="display:inline-block">
<?php echo "$system_name";?>
</span>
<br />
<label>Transmission Type: </label>
<span style="display:inline-block">
<?php echo "$txtype";?>
</span>
<br />
<label>Vlan Number: </label>
<span style="display:inline-block">
<?php echo "$vlan_id";?>
</span>
<br /><br />
<label>IP Address: </label>
<span style="display:inline-block">
<?php echo "$ip_add_c";?>
</span>
<br />
<label>Multicast Address Range:</label>
<span style="display:inline-block">
<?php echo "$mcast/24";?>
</span>
<br />
<label>Location: </label>
<span style="display:inline-block">
<?php echo "$sys_loc";?>
</span>
<br /><br />
<label>Itam name / Itam Status </label>
<span style="display:inline-block">
<?php echo "$ASSETID / $ASSETSTATUS";?>
</span>
<br /><br />
</div>
</div>
<?php
}
}else{
echo "Error";
}