Moving through records in table in a single record page

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • RT

    Moving through records in table in a single record page

    Hello;

    I'm trying to create a updates pages that I can move either to the previous
    record or the next record within a recordset without having to return to the
    repeating list of records after each up date.

    Assuming I have done the recordset correctly, which I have and the update
    records command as well here is the code I'm trying to use:

    <?php
    $prev = ''; $next = '';
    $result = mysql_query("SE LECT id FROM affiliates WHERE id <
    $row_rsaffiliat e[id] ORDER BY id DESC");
    if ($result)
    {
    $row = mysql_fetch_row ($result);
    $prev = $row[0];
    mysql_free_resu lt($result);
    }
    $result = mysql_query("SE LECT id FROM affiliates WHERE id <
    $row_rsaffiliat e[id] ORDER BY id ASC");
    if ($result)
    {
    $row = mysql_fetch_row ($result);
    $next = $row[0];
    mysql_free_resu lt($result);
    }
    ?>

    <?php
    if ($prev) echo '<a
    href="../affiliateeditfo rm.php?id=' . $prev . '"><b>&lt;&lt;P rev</b></a>';
    else echo '<b>&lt;&lt;Pre v</b>';
    ?>
    <?php
    if ($next) echo '<a
    href="../affiliateeditfo rm.php?id=' . $next . '"><b>Next&gt;& gt;</b></a>';
    else echo '<b>Next&gt;&gt ;</b>';
    ?>
    This code works in another page I copied it from but in the page I paste it
    into so that leads me to believe I'm missing something.

    In the New page the Prev and Next labels show up as text and not links
    between the records as I want.

    Any thoughts anyone.

    Thanks

    RT

Working...