0

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

4
Contributors
9
Replies
10
Views
4 Years
Discussion Span
Last Post by cereal
0

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

0

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

1

Like this?? ...

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

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! :)

Edited by cereal

0

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.

0

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>";?>

Edited by cssweb: error

0

@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>

Edited by cereal

0

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>
    ";
}
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.