How to increase LIMIT by one when I click Next

Hello everyone, recently studying PHP and have a serious problem. Here is my case - I have a database in which I have ID, Fullname, and County and Online. As I pressed the button “Next” to transfer to the next member in alphabetical order. But I can not do so in LIMIT can not increase the value of LIMIT by one.
Or do you have any other ideas?
PHP


// Get Info
$result = mysql_query("SELECT * FROM users WHERE id='$id'");
$row = mysql_fetch_array($result);
$id = $_GET['id'];

// Get next link to user by fullname
$queryup = mysql_query("select * from users order by fullname LIMIT ". $idup. " ,1");
$rowidup = mysql_fetch_array($queryup);
$nxt = $rowidup['id'];
echo $nxt;

HTML

<form method="post" action="" onSubmit="window.location.reload()">
<table border="1" width="100%">
<tr>
<td>Full name</td>
<td><input type="text" name="fullname" value="<?php echo $row['fullname']; ?>" /></td>
</tr>
<tr>
<td>E-mail</td>
<td><input type="text" name="email" value="<?php echo $row['email']; ?>" /></td>
</tr>
<tr>
<td>Country</td>
<td>
<?php echo "$row['country']; ?>
</td>
</tr>
<tr>
<td>Online</td>
<td>
<?php
	if ($row['onlinecheck'] == '1') {
	echo "<input type='checkbox' name='onlinecheck' checked value='0' />";
	} else {
	echo "<input type='checkbox' name='onlinecheck' value='1' />";
	}
?>
</td>
</tr>
</table>

<input type="submit" name="submit" class="navbtn" value="Save" />
<?php echo "<a href='index.php?id=$nxt' class='navbtn'>Next »</a>"; ?>
</form>

Why not grab the next id by using the same GET id you use to call the display record only instead of using equal use greater-than limit 1.

<?php
// Get Info	
$id = mysql_real_escape_string($_GET['id']);
$result = mysql_query("SELECT * FROM users WHERE id = '$id'");
$row = mysql_fetch_array($result);

// Get next link to user by fullname
$queryup = mysql_query("select id from users WHERE id > '$id' order by fullname LIMIT 1");
$rowidup = mysql_fetch_array($queryup);
$nxt = $rowidup['id'];
?>

You also missed the end quote on this line, which should also have brackets.

<?php echo "{$row['country']}"; ?>

You can also build an array of valid user id’s to both check your GET[‘id’] against but also to get the next “key”/id pair in the user array.


<?php
// get user id's build array//
$users = array(); 
$query = mysql_query("select id from users order by fullname ASC");
while($rowlist = mysql_fetch_array($query)){
	$users[] = $rowlist['id'];
} 

// Get Info	  
$id = mysql_real_escape_string($_GET['id']);

//double check $id against list
if (isset($id) && in_array($id,$users)){
	$result = mysql_query("SELECT * FROM users WHERE id = '$id'");
	$row = mysql_fetch_array($result);
	
	
	// Get next link to user by the next key
	$current_key = array_search($id,$users);
	$possible_next = $current_key+1;
	//if possible_next is a valid user id use it, else start over
	$nxt = (array_key_exists($possible_next,$users) ? "{$users[$possible_next]}" : "{$users[0]}"); 
	?>
	<form method="post" action="" onSubmit="window.location.reload()">
	<table border="1" width="100%">
	<tr>
	<td>Full name</td>
	<td><input type="text" name="fullname" value="<?php echo "{$row['fullname']}"; ?>" /></td>
	</tr>
	<tr>
	<td>E-mail</td>
	<td><input type="text" name="email" value="<?php echo "{$row['email']}"; ?>" /></td>
	</tr>
	<tr>
	<td>Country</td>
	<td>
	<?php echo "{$row['country']}"; ?>
	</td>
	</tr>
	<tr>
	<td>Online</td>
	<td>
	<?php
		if ($row['onlinecheck'] == '1') {
		echo "<input type='checkbox' name='onlinecheck' checked value='0' />";
		} else {
		echo "<input type='checkbox' name='onlinecheck' value='1' />";
		}
	?>
	</td>
	</tr>
	</table>
	
	<input type="submit" name="submit" class="navbtn" value="Save" />
	<?php echo "<a href='index.php?id=$nxt' class='navbtn'>Next »</a>"; ?>
	</form>
<?php } ?>