1

我正在尝试填充从我的 MySQL 数据库中提取数据的表,数据库中有 3 个条目,但由于某种原因回显数据不起作用,尽管我可以看到它正在循环 3 次(表创建3 个复选框,每个条目 1 个)

代码

<?php 
    $qry2="SELECT * FROM buytraff WHERE username='$username'";
    $result2=mysql_query($qry2) or die(mysql_error()); 
    while ($rows = mysql_fetch_assoc($result2)):?>

<tr class="first">
<td class="tc">&nbsp;</td>
<td class="tc"><center><font face="Arial, Helvetica, sans-serif"></font><font face="Arial, Helvetica, sans-serif"><? echo $rows['id']; ?></font>
</center></td>
<td class="tc"><center><font face="Arial, Helvetica, sans-serif"><? echo $rows['url']; ?></font></center></td>

<td><center><font face="Arial, Helvetica, sans-serif"><? echo $rows['nichecountry']; ?></font></center></td>
<td class="tc"><center><font face="Arial, Helvetica, sans-serif"><?php if($rows['type']=='1.99'){
echo "something";
}

elseif($rows['type']=='2.99'){
echo "something";
}

elseif($rows['type']=='3.00'){
echo "something";
}

elseif($rows['type']=='4.00'){
echo "something";
}

?></font></center></td>
<td class="tc"><center><font face="Arial, Helvetica, sans-serif"><? echo $rows['price']; ?> $</font></center></td>
<td class="tc"><center><font face="Arial, Helvetica, sans-serif"><? echo $rows['amount']; ?></font></center></td>
<td class="tc"><center><font face="Arial, Helvetica, sans-serif"><? echo $rows['delivered']; ?></font></center></td>
<td class="tc"><center><font face="Arial, Helvetica, sans-serif"><? echo $rows['status']; ?></font></center></td>
<td class="tc"><center><input name="checkbox[]" type="checkbox" class="checkbox" id="checkbox[]" value="<? echo $rows['id']; ?>"></center></td> 
</tr>
<?php endwhile; ?>
4

1 回答 1

1

使用 PHP 短标签

在 XAMPP 中,您需要在以下位置启用此选项PHP.ini

short_open_tag = On
于 2012-12-30T12:44:38.170 回答