gpt4 book ai didi

php - 如何添加编号或项目符号?

转载 作者:行者123 更新时间:2023-11-29 06:13:18 27 4
gpt4 key购买 nike

我想知道如何将项目符号编号放入表格中。下面我循环回显主要指南和子指南的列表。

例如:

1. major1   a. sub1   b. sub2   c. sub32. major2   a. sub1   b. sub2   c. sub3

something like that.

<table width="594" height="82" cellpadding="3" bordercolor="#999999">
<tr>
<td width="38" height="20" bgcolor="#333333" scope="col"><span class="style30"></span></td>
<td width="234" bgcolor="#333333" scope="col"><div align="center" class="style31">Behavioral Guidelines</div></td>
<td colspan="4" bgcolor="#333333" scope="col"><div align="left" class="style31">
<div align="center">Style</div>
</div></td>
<td scope="col">&nbsp;</td>
</tr>
<?php while($row = mysql_fetch_array($result2)){?>
<tr>
<td height="24" valign="top" bgcolor="#FFFFCC"><div align="center" class="style7">Major</div></td>
<td valign="top" bgcolor="#FFFFCC"><div align="left"><span class="style29"><?php echo $row['majorBg'];?></span></div></td>
<td width="17" valign="top" bgcolor="#FFFFCC"><div align="center"><span class="style15"><?php echo $row['msg'];?></span></div></td>
<td width="17" valign="top" bgcolor="#FFFFCC"><div align="center"><span class="style15"><?php echo $row['mct'];?></span></div></td>
<td width="17" valign="top" bgcolor="#FFFFCC"><div align="center"><span class="style15"><?php echo $row['mch'];?></span></div></td>
<td width="17" valign="top" bgcolor="#FFFFCC"><div align="center"><span class="style15"><?php echo $row['mad'];?></span></div></td>
<td width="194" valign="top" bgcolor="#FFFFCC"><span class="style24"><a href="sub.php?major_id=<? echo $row['major_id']; ?>" class="style22" >+ add sub guidelines (optional)</a></span></td>
</tr>
<? $sqlCommand="select * from sub_guidelines where major_id =". $row['major_id'];
$sql1 = mysql_query($sqlCommand) or die (mysql_error());
while($row1 = mysql_fetch_array($sql1))
{?>
<tr>
<td height="2"><div align="center"><span class="style7">Sub</span></div></td>
<td height="2"><div align="left"><span class="style15"><?php echo $row1['subBg'];?></span></div></td>
<td height="2" class="style15"><div align="center"><?php echo $row1['ssg'];?></div></td>
<td height="2" class="style15"><div align="center"><?php echo $row1['sct'];?></div></td>
<td height="2" class="style15"><div align="center"><?php echo $row1['sch'];?></div></td>
<td height="2" class="style15"><div align="center"><?php echo $row1['sad'];?></div></td>
<td height="2" class="style15"><div align="left"></div></td>
<?php } ?>
</tr>
<?php } ?>
<?php mysql_close($con) ?>
</table>

结果是:

1. major1     a. sub1     a. sub2     a. sub31. major2     a. sub1     a. sub2     a. sub3

它们的主要和次要编号相同。

最佳答案

您可以使用以下 HTML 来完成此操作。根据需要调整 PHP 脚本以获得以下输出。

<ol>
<li>major1
<ol type="a">
<li>sub1
<li>sub2
<li>sub3
</ol>
<li>major2
<ol type="a">
<li> sub1
<li> sub2
<li> sub3
</ol>
</ol>

关于php - 如何添加编号或项目符号?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8074166/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com