<?php require('system/login.php');  ?>
<?php require_once('../Connections/BE2.php'); ?>
<?php
if ((isset($_GET['del_id'])) && ($_GET['del_id'] != "")) {
  $deleteSQL = sprintf("DELETE FROM tb2city WHERE bctid='%s'",$_GET['del_id']);
  mysql_select_db($database_BE2, $BE2);
  $Result1= mysql_query($deleteSQL, $BE2) or die(mysql_error());
}


$colname_Rt2 = "-1";
if (isset($_GET['id'])) {
  $colname_Rt2 = $_GET['id'];
}


mysql_select_db($database_BE2, $BE2);
$query_Rt2 =sprintf("select c.buid,c.bc2,c.bc3,c.bc4,a.*,b.bctid,b.bctaddr,b.bcttel from tb2 as c,tb1 as a, tb2city as b WHERE  a.ec1=b.ec1 AND b.buid2='%s' AND c.buid=b.buid2 order by a.tbc0,a.ec4",$colname_Rt2);
$Rt2 = mysql_query($query_Rt2, $BE2) or die(mysql_error());
$row_Rt2 = mysql_fetch_assoc($Rt2);
$totalRows_Rt2 = mysql_num_rows($Rt2);
//  if($_SERVER['REMOTE_ADDR']=='220.130.43.121'){ echo $query_Rt2;}
?>
<div><span class="font2"><? echo $row_Rt2['bc2']." ".$row_Rt2['bc3'].$row_Rt2['bc4'] ?></span><a href="main.php?act=tb2cityadd&amp;id=<?= $row_Rt2['buid']?>">   <img src="images/add.png" width="80" height="16" /></a></div> 
<div id="content" align="center">
 
 <table width="71%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <th height="33" align="center" valign="middle" nowrap="nowrap" class="font2">選擇</th>
          <th valign="middle" nowrap="nowrap" class="font2">服務城市</th>
          <th align="center" valign="middle" class="font2">服務電話</th>
          <th align="center" valign="middle" class="font2">服務地址</th>
          <th align="center" valign="middle" class="font2">刪除</th>
        </tr>
        <?php
		  $i=0;
		 do { 
		 $i++;
		 ?>
        <tr>
          <th width="7%" align="center" valign="top" nowrap="nowrap" class="font3"><a href="main.php?act=tb2cityedit&id=<?= $row_Rt2['bctid']?>"><img src="images/edit.png" alt="修改項目名稱" title="修改項目名稱" width="16" height="16" border="0" /></a></th>
          <td width="8%" align="center" valign="top" class="font3"><?= $row_Rt2['ec3']; ?></td>
          <td width="27%" align="center" valign="top" class="font3"><?= $row_Rt2['bcttel']?></td>
          <td width="27%" align="center" valign="top" class="font3"><?= $row_Rt2['bctaddr']?></td>
          <td width="31%" align="center" valign="top" class="font3"><a href="javascript:if(confirm('確實要刪除嗎?'))location='<? echo 'main.php?act=cuser_city2&del_id='.$row_Rt2['bctid'] ;?>&id=<?= $row_Rt2['buid']?>'"><img src="images/del.png" alt="刪除項目" width="16" height="16" border="0"/></a></td>
        </tr>
 
        <?php } while ($row_Rt2 = mysql_fetch_assoc($Rt2)); ?>
        <tr>
          <td height="3" colspan="5" align="center" >&nbsp;</td>
        </tr>
    </table> 
 
</div>
 

<?php
mysql_free_result($Rt2);
?>
