php和mysql mysql_fetch_行

php和mysql mysql_fetch_行,php,mysql,Php,Mysql,我不知道在获取行时预期会出现什么问题:\ 为什么结果是这样的 $result=mysql_query($query); $tbl.="<table id=tblsearch align =center border=0 > <tr bgcolor=gray>"; $RowNum =mysql_num_fields($result); //name of field :) .

我不知道在获取行时预期会出现什么问题:\ 为什么结果是这样的

$result=mysql_query($query);
            $tbl.="<table id=tblsearch align =center border=0 > 
            <tr bgcolor=gray>";

            $RowNum =mysql_num_fields($result);
            //name of field :) .... 
            for($col=0;$col<$RowNum;$col++)

            $tbl.='\n <th font color=white>'.
             mysql_field_name($result, $col).'</font></th>';
            //update/delete OK 
            $tbl.='\n </tr>';
            $rownow=1;
            while ($row =mysql_fetch_row($result)) { //fetch_row
                $tbl.'<tr onmousemove=\"HighLightRow($rownow)\" bgcolor=#eehh99';
                if ($rownow%2==0)
                $tbl.="#669999>";
                else 
                    $tbl.="#66CC99>";
                    $rownow++;
            for($col=0;$col<$RowNum;$col++)
            $tbl.='\n  <td> $row[$col] </td>';
            $tbl.='</tr>';
            }//while

            if(mysql_errno()==0)

            return $tbl.'</table>';
         else 
             return "error".mysql_error();

           }//function
$result=mysql\u查询($query);
$tbl.=”
";
$RowNum=mysql\u num\u字段($result);
//字段名称:)。。。。

对于($col=0;$col变量仅在双引号内展开,而不是在单引号内展开。因此更改:

$tbl.'<tr onmousemove=\"HighLightRow($rownow)\" bgcolor=#eehh99';

$tbl.'我不明白。为什么你需要成为一名大师才能使用正确的函数?当我学习这些函数时,我会的
$tbl."<tr onmousemove=\"HighLightRow($rownow)\" bgcolor=#eehh99";
$tbl.='\n  <td> $row[$col] </td>';
$tbl.="\n  <td> $row[$col] </td>";