from the sample code provided you have messed up the tag order. try this. Note i have moved the tag orders. Hope this is what you want to achieve. too unclear from the question.
<table>
<?php
$result = mysql_query("........",$db);
if(mysql_num_rows($result) > 0)
{
echo '<tr><td><ul>';
$myrow = mysql_fetch_array($result);
do
{
printf ("<li type=\"1\">%s</li>",$myrow["var"]);
}
while ($myrow = mysql_fetch_array($result));
echo '</ul></td></tr>';
}
else
{
echo "<p align='center'>error...</p>";
}
?>
</table>
tag order should be. you cannot insert <table>
as a child of <ul>
. <ul>
can have only <li>
as child.
<table>
<tr>
<td>
<ul>
<li>...</li>
</ul>
</td>
</tr>
</table>
Edit:
You may not need the <ul>...</ul>
tags. you can do it with simple table. Try this
<?php
$result = mysql_query("........",$db);
if(mysql_num_rows($result) > 0)
{
echo '<table>';
$rownum=1; //just a counter here, if have other real value then use it
$myrow = mysql_fetch_array($result);
do
{
printf ("<tr><td>%d</td><td>%s</td></tr>", $rownum, $myrow["var"]);
$rownum++;
}
while ($myrow = mysql_fetch_array($result));
echo '</table>';
}
else
{
echo "<p align='center'>error...</p>";
}
?>
and if you want to do it with just ordered list you can do it like the following
<?php
$result = mysql_query("........",$db);
if(mysql_num_rows($result) > 0)
{
echo '<ol>';
$myrow = mysql_fetch_array($result);
do
{
printf ("<li>%s</li>", $myrow["var"]);
$rownum++;
}
while ($myrow = mysql_fetch_array($result));
echo '</ol>';
}
else
{
echo "<p align='center'>error...</p>";
}
Note: the type
attribute of <li>
is deprecated in HTML 4.01. and is not supported in HTML 5.