提取当前提取的$sql行下方的行上的值


Extract a value on the line below the current $sql line extracted

我有一个表格mytable,其中包含这些列string pagename

我必须提取$pagename但我还需要提取此行下方行的下一个$pagename以进行页面导航。例如,如果我需要$pagenameWHERE string='100001'我将需要下一个页面名称,该名称将是$string等于 $nextpagestr=($currentline['string']+1);100002(知道我的右大括号$sql在 $sql 2 之后)

我已经尝试了下面的代码,但是当我悬停在链接上时,它显示Array.php而不是我期望的值

    <?php
    include 'includes/connectdb.php';
    $sql="select * from mytable where string=100001";
    $result=mysql_query($sql);
    while($currentline=mysql_fetch_assoc($result))
    {
        extract($currentline);
    $nextpagestr=($currentline['string']+1);
    $previouspagestr=($currentline['string']-1);
    ?>
     <!-- SOME CODE HERE ... -->  <?php echo $currentline['pagename']; ?>
     <!-- THEN MY NAVIGATION: -->  
     <a class="next-link" href="<?php 
     $sql2='SELECT pagename FROM mytable WHERE string=$nextpagestr'; 
     $result2 = mysql_query($sql2); 
     while($pagename=mysql_fetch_assoc($result2)) 
     {echo($pagename);} ?>.php">Next Page</a>

    <?php } ?>  <!-- CLOSING BRACE FOR THE FIRST $SQL --> 

嗯....

 $result2 = mysql_query($sql2); 
 while($currentline=mysql_fetch_assoc($result2)) 
 {
     extract($currentline);
     echo($currentline['pagename']); ?>.php">Next Page</a>
 <?php } ?>