0

这个函数正确吗?它不断返回:解析错误:语法错误,意外';',在第 301 行的 C:\Program Files (x86)\Apache Group\Apache2\htdocs\test\include\class.mysqltools.php 中期待 T_FUNCTION

301 是最后一行...任何帮助表示赞赏,谢谢!

function DisplayA($query, $rowname1, $rowname2) {
    $result = mysql_query($query);
    $buffer = $buffer .="<table>";
    while($row = mysql_fetch_array($result)){
    $buffer = $buffer .="<tr><td>" . $row[$rowname1] . "</td><td>" . $row[$rowname2] . "</td></tr>";
    }
    $buffer = $buffer .="</table>";
    return $buffer;
}
4

1 回答 1

1

尝试:

function DisplayA($query, $rowname1, $rowname2) {
    $result = mysql_query($query);
    $buffer .= "<table>";
    while($row = mysql_fetch_array($result)){
        $buffer .= "<tr><td>" . $row[$rowname1] . "</td><td>" . $row[$rowname2] . "</td></tr>";
    }
    $buffer .= "</table>";
    return $buffer;
}

不确定您是否$buffer = $buffer .=可能导致了一些意想不到的结果。将所有实例更改为仅$buffer .=

于 2013-11-14T17:25:01.893 回答