I want to auto increment serial number of result fetched from query on page like 1,2,3......
Below is my piece of code:
<td><font size="-1"><?php echo $++i ?> </font></td><td><font size="-1">
Now <?php echo $++i ?>
fetches actual row id which is 17,18 of a table. i want just simple value 1,2,3...so on
Inside your table row you can echo incremented variable (simple counter):
<?php $i = 0; ?>
...
<tr><td><?php echo ++$i;?></td><td><font size="-1"><?php echo $row['id']; ?> </font></td></tr>
...
You could start your own variable and increment it, but it might be easier for you to instead subtract to get the value you want. change you code from:
<?php echo $row['id']-16; ?>
to
<?php echo $row['id']-16; ?>
an example you can run to show this works:
<?php $row = array('id' => '17'); ?>
<?php for($row['id']; $row['id']<40; $row['id']++){ ?>
<?php echo $row['id']-16; ?>
<?php } ?>