想請教一下,我用PHP 連MSSQL SELECT 資料表,
在用格線將資料表的內容秀在網頁上,
但是SELECT 欄位有些值是空白的,就會如圖片一樣,沒格線
不知道有沒有辦法解決謝謝~!
<?php
$serverName = "IP";//資料庫位子
$uid = "sa"; //帳號
$pwd = "123456";//密碼
$connectionInfo = array( "UID"=>$uid,"PWD"=>$pwd,"Database"=>"AAAA","CharacterSet" => "UTF-8");
$con = sqlsrv_connect( $serverName, $connectionInfo);
$dl="select LIO001.SerialNumber,LIO001.Textbox1 as '合約編號',LIO001.Textbox4 as '合約名稱',LIO001.Textbox2 as '申請人',LIO001.Textbox5 as'對方名稱',convert(char,LIO001.Date1,111) as'申請日期',convert(char,LIO001.Date2,111) as'生效日期',convert(char,LIO001.Date3,111) as'失效日期',convert(char,LIO001.Date4,111) as'歸檔日期',LIO001.Textbox6 as '總金額',case LIO001.RadioButton1 when 0 then '無' when 1 then '應繳納'end as '印花稅',LIO001.Textbox23 as '備註' ,case ProcessInstance.currentState when 0 then '未開始' when 1 then '進行中' when 2 then '已暫停' when 3 then '已完成' when 4 then '已撤銷' when 5 then '已中止' end as'狀態' from LIO001,ProcessInstance where ProcessInstance.serialNumber=LIO001.processSerialNumber";
$da=sqlsrv_query($con,$dl);
echo "<table border=1>";
echo "<td>流程編號</td><td>合約編號</td><td>合約名稱</td><td>申請人</td><td>對方名稱</td><td>申請日期</td><td>生效日期</td><td>失效日期</td><td>歸檔日期</td><td>總金額</td><td>印花稅</td><td>備註</td><td>狀態</td><tr>";
while( $count=sqlsrv_fetch_array( $da ) )
{
$a1=$count[0];
$a2=$count[1];
$a3=$count[2];
$a4=$count[3];
$a5=$count[4];
$a6=$count[5];
$a7=$count[6];
$a8=$count[7];
$a9=$count[8];
$a10=$count[9];
$a11=$count[10];
$a12=$count[11];
$a13=$count[12];
echo "<tr><td>$a1</td><td>$a2</td><td>$a3</td><td>$a4</td><td>$a5</td><td>$a6</td><td>$a7</td><td>$a8</td><td>$a9</td><td>$a10</td><td>$a11</td><td>$a12</td><td>$a13</td></tr>";
}
echo "</table>";
?>
td tag不見了....另外你的變數串接字串最好用 "."去串接 "<td>".$a1."</td>"
<pre class="c" name="code"> echo "<tr><td>".$a1."</td><td>".$a2."</td><td>".$a3."</td>....................";