2010-05-24 85 views
0
<?php 

// Connection Database 
$search = $_POST ['Search']; 

mysql_connect("xxxxxx", "xxxxxxxxx", "xxxxxx") or die ("Error  Connecting to Database"); 
     mysql_select_db("xxxxxx") or die('Error'); 
    $data = mysql_query("SELECT* FROM course WHERE MATCH (CourseName, CourseDescription, CourseLeader) AGAINST ('". $search ."')") 
     or die (mysql_error()); 
Print "<table border cellpadding=3>"; 
while($info = mysql_fetch_array($data)) 
{ 
Print "<tr>"; 
Print "<th>Course Name:</th> <td>".$info['CourseName'] . "</td> "; 
Print "<th>Course Description:</th><td>".$info['CourseDescription'] . "</td> "; 
Print "<th>Course Leader:</th><td>".$info['CourseLeader'] . " </td></tr>"; 

} 
Print "</table>"; 

?> 

在我的php代碼中,我在搜索後打印了CourseName,CourseDescription,CourseLeader列作爲結果集。 CourseDescription有很多文字,我怎麼打印這一切?有沒有辦法改變列的寬度?在mysql查詢中更改列寬

+0

究竟是什麼問題呢?文本是被截斷的(在一定數量的特徵後切斷 – nickf 2010-05-24 23:10:55

+0

是的CourseDescription正在被切斷 – addi 2010-05-24 23:26:46

+0

當你從MySQL查詢瀏覽器運行時你能看到它是否正確嗎?嘗試在那裏運行你的查詢。 – 2010-05-24 23:59:47

回答

0

調整使用寬度參數

<th width="25%"> 

OR

<th width="400px"> 

您的代碼應該像下面

Print "<tr>"; 
Print "<th width='20%'>Course Name:</th> <td width='80%'>".$info['CourseName'] . "</td> "; 
Print "<th width='20%'>Course Description:</th><td width='80%'>".$info['CourseDescription'] . "</td> "; 
Print "<th width='20%'>Course Leader:</th><td width='80%'>".$info['CourseLeader'] . " </td></tr>";