开发者

change column widths in mysql query

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

?>

In my php code I print the columns CourseName, CourseDescription, CourseLeader after a search, as a resultset. C开发者_如何学JAVAourseDescription has a lot of text, how do I print it all? is there a way to change the column widths?


Adjust Using width parameter in

<th width="25%">

OR

<th width="400px">

Your code should be something like following

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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜