iT邦幫忙

0

PHP-SELECT空白的欄位框線怪怪的

想請教一下,我用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>";
?>
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

1 個回答

0
bluesky1213
iT邦新手 3 級 ‧ 2014-09-17 02:21:29
最佳解答

td tag不見了....另外你的變數串接字串最好用 "."去串接 "<td>".$a1."</td>"

&lt;pre class="c" name="code">  echo "&lt;tr>&lt;td>".$a1."&lt;/td>&lt;td>".$a2."&lt;/td>&lt;td>".$a3."&lt;/td>....................";

應該是IE8問題~~我測試你的寫法也是可以,但字串串接變數寫法最好還是改一下。

可以檢查IE8 與其他瀏覽器產生出來的原始碼差了哪邊,如果你要針對IE8修改才能清楚

pp73793 iT邦新手 4 級 ‧ 2014-09-18 08:55:52 檢舉

可能是我開程式的時後沒有用 html 格式去寫 php 才造成 這個問題,我改用 html 改成 php 就ok了~~

我要發表回答

立即登入回答