Jump to content

[SOLVED] 1-10 List using $i


e1seix

Recommended Posts

a simple question i know but i'm having trouble implementing it with the following code:

 

while($row = mysql_fetch_array( $fetch )) {

// Print out the contents of each row into a table
echo "<tr>";
        echo "<td style='border-bottom: 1px solid #000000;text-align:center'>";

        echo "<span class='lip2'>";
        echo '* <a href="'.$_HTTPS['PHP_SELF'].'show.php?sku='.$row['sku'].'&productDetail='.$row['title'].'" style="color:#000000">';
        echo $row['size']." ";
        echo $row['title']." ";
        echo $row['type'];
echo "</a>";
        echo "</span>";
        echo "</td>";
        echo "</tr>";

}

 

I need to replace the "*" with conscentric numbers listing 1 to 10 as the 10 results are listed. i know it's a for i loop but i can't seem to get it right. any help?

 

many thanks,

Link to comment
https://forums.phpfreaks.com/topic/77672-solved-1-10-list-using-i/
Share on other sites

<?php

$i=1;
while($row = mysql_fetch_array( $fetch )) {

// Print out the contents of each row into a table
echo "<tr>";
        echo "<td style='border-bottom: 1px solid #000000;text-align:center'>";

        echo "<span class='lip2'>";
        echo $i.' <a href="'.$_HTTPS['PHP_SELF'].'show.php?sku='.$row['sku'].'&productDetail='.$row['title'].'" style="color:#000000">';
        echo $row['size']." ";
        echo $row['title']." ";
        echo $row['type'];
echo "</a>";
        echo "</span>";
        echo "</td>";
        echo "</tr>";
$i++;
}

?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.