hello how are you guys i am a new member here and want your assist and this is the first topic for me
the question is how can i use

<ol><li></li></ol> in while as this

<table width='100%' border='1'>
while ($row=mysql_fetch_object){
echo "
<tr>
<td>$row->name</td>
/tr>";
}

</table>
i want to Punctuation the name as the previous code
this is the example about what do i want

1.php
2.mysql
3.css
4.html

thank you a lot guys

Recommended Answers

All 9 Replies

I don't understand what you are asking, can you explain again what you are trying to do? And what the problem is?

hello
i have asked about how can i use Punctuation in the while loop

Like this?? ...

echo '<ul>';
while ($row = mysql_fetch_object) {
    echo '<li>' . $row->name . '</li>';
}
echo '</ul>';

You have two solutions, the first one:

$i = 0;
while($row = mysql_fetch_object($query))
{
    $i++;
    echo "
    <tr>
        <td>$i. $row->name</td>
    </tr>
    ";
}

The second is to print the list all inside one row:

echo "<tr><td><ol>";
while($row = mysql_fetch_object($query))
{
    echo "<li>$row->name</li>\n";
}

echo "</ol></td></tr>";

EDIT

I think Dani gave the right answer.. I was including it inside the table.. Bye! :)

cereal, I think that if you want to do $row->name inside of a double-quoted echo statement, you need to wrap it in curly braces.

i have trye as you say but it look like as cirle not number and as you say i want to make punctunation for this
<li>comment:</li>

echo '<ol>';
while ($row_comm=mysql_fetch_object($displaycomments)){
echo "
<tr>
<td>
<br/>
<center>name: <b><font color='red'>$row_comm->comm_name</font></b>     |     from : <b><font color='red'>$row_comm->comm_country </font></b> </center><br/>
</td>
</tr>

<tr>
<td><div id='commt'><b><font color='red'><li>comment:</li></b> </font></div><div id='commedit'> $row_comm->comm  </div></td><br/>

</tr>

<tr>
<td><hr></hr></td>
</tr>
";


}
echo '</ol>';

?>
<?echo "</table>";?>

@Dani works fine for me :)

<?php
Class Test
{
    public $hello = "hello world";
}

$a = new Test();
echo "$a->hello";
?>

@cssweb
check the suggested solutions, you have to change your tags if you want to use ordered lists, right now you are mixing a list and a table, this is wrong:

<table>
    <ol>
        <tr>
            ...
        </tr>
    </ol>
</table>

thank for all guys especially for cereal proplem has been solved by this way

$i = 0;
while($row = mysql_fetch_object($query))
{
    $i++;
    echo "
    <tr>
        <td>$i. $row->name</td>
    </tr>
    ";
}

Ok, then mark the thread as solved. Bye :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.