Simple Counter
Posted: Tue May 18, 2004 12:35 am
My problem is very simple
In the result i got the all values in tables but my counter always shows value 1 in all the fields
My code is as follows
The problem is in the line
[/b]
It always shows 1 in each column
In the result i got the all values in tables but my counter always shows value 1 in all the fields
My code is as follows
Code: Select all
<?php
while ($row = mysql_fetch_object($result))
{
$counter = 1;
$value = $row -> innovatorid;
$result1 = mysql_query("SELECT * FROM innovator WHERE innovatorid="$value"") or die("Query 2 Wrong");
$total1 = mysql_num_rows($result1);
while ($row1 = mysql_fetch_object($result1))
{
print("<tr>");
print("<td align="center">" . $counter++ . "</td>");
print("<td align="center"><a href="innovators.php? innovatorid=" . $row1 -> innovatorid . "">" . $row1 -> fname . "</a></td>");
print("<td align="center"><a target="New Window" href="http:\cases" . $row1 -> linkpage . "">" . $row1 -> linkpage . "</a></td>");
print("</tr>");
}
$counter = $counter + 1;
// echo "$counter";
}
?>Code: Select all
<?php
print("<td align="center">" . $counter++ . "</td>");
?>It always shows 1 in each column