Jump to content

Get Next Record


lilywong

Recommended Posts

How to get the next record for each time the icon is pressed ?
the database like
1000
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
for example, the first record showed is 1000, when i press the icon, it should only show 1000, when i press the icon second time, it shold only display 1550, the third time i pressed it should only show 1551. (ie. click one time, and the running number will increase one )
however my code will show all the records from the first until the end, what's the problem ?

below is the codes.
===================================================================
$sql = "SELECT * FROM record";
$rs = $db->Execute($sql);

$record = $rs->fields[RecordNo];
$total = $rs->RecordCount();
$i = 0;
?>

<form method='post' action='index.php'>

<table width='200' border=1>
<tr><td width='100'>Current Number</td>
<td width='100'><?=$record?></td>
<tr>

<tr>
<td colspan='2' align='right'>
<a href='index.php?generate=generate'><img src='images/mouse.gif' border='0' title='GENERATE'></a></td>
</tr>

</table>
</form>
<?
if ($_GET[generate]==generate)
{
while (!$rs->EOF)
{
$record = $rs->fields[RecordNo];
print $record;
echo "<br>";
$rs->MoveNext();
}


}
?>
Link to comment
Share on other sites

  • 2 years later...
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.