在mysql查询中更改列宽

在mysql查询中更改列宽

问题描述:

<?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

调整使用宽度参数

<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>";