你好 :
我用以下語法搜尋出來的資料內容排序亂亂的
<?
$result = mysql_query ("SELECT * FROM date WHERE customer like '%11%' ") ;
$i=1 ;
while ( $date = mysql_fetch_row ($result)) {
echo "第 " . $i++ . "筆資料 :<br>" ;
print_r ( $date );
echo "<br>";
}
?>
出來變以下這樣
第 1筆資料 :
Array ( [0] => 許蓋功 [1] => 111 [2] => [3] => [4] => [5] => [6] => [7] => [8] => [9] => [10] => [11] => [12] => [13] => [14] => [15] => [16] => [17] => [18] => [19] => [20] => 14 [21] => )
第 2筆資料 :
Array ( [0] => 111 [1] => 111 [2] => [3] => [4] => [5] => [6] => [7] => [8] => [9] => [10] => [11] => [12] => [13] => [14] => [15] => [16] => [17] => [18] => [19] => [20] => 15 [21] => )
第 3筆資料 :
Array ( [0] => 111 [1] => 11 [2] => 111 [3] => 11 [4] => [5] => [6] => [7] => [8] => [9] => [10] => [11] => [12] => [13] => [14] => [15] => [16] => [17] => [18] => [19] => [20] => 16 [21] => )
第 4筆資料 :
Array ( [0] => 11 [1] => 11 [2] => 11 [3] => 11 [4] => 11 [5] => 11 [6] => 11 [7] => 111 [8] => 11 [9] => [10] => [11] => [12] => [13] => [14] => [15] => [16] => [17] => [18] => [19] => [20] => 17 [21] => )
用「order by」先把select出來的資料給先排好..
SELECT * FROM date WHERE customer like '%11%' order by [欄位名稱]
[欄位名稱]-->指要依那個欄位做排序..
這樣應該就行啦..
你好:
我希望達到的是以下的效果,因無法貼圖,我簡單的表現一下
|-------------------------------------------------------------|
|date | customer | address | contact | man email |
|-------------------------------------------------------------|
|98.12.2 | 測試 | 測試 | 測試 | 測試 測試 |
|-------------------------------------------------------------|
另外請畫面因太小會斷一行下來 這要如何不會斷下來呢 以1024x768的網頁規格
<table>
<tr><td>資料01</td><td>資料02</td><td>資料03</td></tr>
<tr><td>資料11</td><td>資料12</td><td>資料13</td></tr>
</table>
如果是網頁的話,可以用<table>排,如果是要export出來的,可以用printf()做格式化
你好:
是在網頁輸出沒錯 希望能有以下效果 因無法貼圖,我簡單表現,但是表格是齊的
|-------------------------------------------------------------|
|date | customer | address | contact | man email |
|-------------------------------------------------------------|
|98.12.2 | 測試 | 測試 | 測試 | 測試 測試 |
|-------------------------------------------------------------|
你的需求應該可以用<table>解決