与colspan的PHP错误

时间:2012-02-12 21:15:55

标签: php

这是我当前的PHP脚本,用于显示表格排名当我尝试添加colspan =“2”来拉伸标题时,我的页面上一直出现错误

 $data = mysql_query("SELECT * FROM `standings` WHERE division = 1 ORDER BY TotalPoints DESC;") 
 or die(mysql_error()); 
 Print "<table border cellpadding=10 width=500>"; 
 Print "<tr><th colspan="2">CONLEY</th></tr>";
  Print "<tr><th>Team Members</th><th>Points</th></tr>"; 
 while($info = mysql_fetch_array( $data )) 
 { 

 Print " <td>".$info['TeamMembers'] . "</td> ";
 Print " <td>".$info['TotalPoints'] . "</td> </tr>";

 } 
 Print "</table>"; 

1 个答案:

答案 0 :(得分:1)

您可能需要转义引号,否则它们会破坏字符串并导致错误:

Print "<tr><th colspan=\"2\">CONLEY</th></tr>";