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;
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.