Reputation: 48
i don't know what is the expected problem in fetching rows :\ why the result look like this ?
$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
please don't tell me to use mysqli instead of mysql -_- i will in future i'm a student and To become a master first i must learn to be a student.
Upvotes: 0
Views: 53
Reputation: 781058
Variables are only expanded inside double quotes, not single quotes. So change:
$tbl.'<tr onmousemove=\"HighLightRow($rownow)\" bgcolor=#eehh99';
to:
$tbl."<tr onmousemove=\"HighLightRow($rownow)\" bgcolor=#eehh99";
and:
$tbl.='\n <td> $row[$col] </td>';
to:
$tbl.="\n <td> $row[$col] </td>";
Upvotes: 2