Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/33.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
我需要为一个PHP MYSQL表分配一个unqiue类';s TR_Php_Css_Mysql_Html Table - Fatal编程技术网

我需要为一个PHP MYSQL表分配一个unqiue类';s TR

我需要为一个PHP MYSQL表分配一个unqiue类';s TR,php,css,mysql,html-table,Php,Css,Mysql,Html Table,如何为所有 即使在刷新时,id也需要保留,因为我将使用它们来设置表格的样式 以下是我正在使用的代码: while($row = mysql_fetch_array($result2)) { echo "<tr id='centered' class='"; echo "'"; echo "<td>" . $row['Year_9'] . "</td>"; echo "<td>" . $row['Year_8'] . "</td>"

如何为所有
即使在刷新时,id也需要保留,因为我将使用它们来设置表格的样式

以下是我正在使用的代码:

while($row = mysql_fetch_array($result2))
  {
echo "<tr id='centered' class='";  echo "'";   
echo "<td>" . $row['Year_9'] . "</td>";
echo "<td>" . $row['Year_8'] . "</td>";
echo "<td>" . $row['Year_7'] . "</td>";
echo "<td>" . $row['Year_6'] . "</td>";
echo "<td>" . $row['Year_5'] . "</td>";
echo "<td>" . $row['Year_4'] . "</td>";
echo "<td>" . $row['Year_3'] . "</td>";
echo "<td>" . $row['Year_2'] . "</td>";
echo "<td>" . $row['Year_1'] . "</td>";
echo "<td>" . $row['Year_0'] . "</td>";
while($row=mysql\u fetch\u数组($result2))
{

echo“是否可以将计数器与多值类一起使用

$i = 1;

while($row = mysql_fetch_array($result2))
{
    $secondClass = 'abc' + $i;

    echo "<tr id='centered' class='firstClass $secondClass'>";
    ...
    $i++;
}
$i=1;
while($row=mysql\u fetch\u数组($result2))
{
$secondClass='abc'+$i;
回声“;
...
$i++;
}

你能澄清你想做什么吗?你只是想给每个tr一个唯一的id吗?你想使用的名称周围有限制吗?等等,你想要一个唯一的类或id吗?