Search Results

Search found 1 results on 1 pages for 'rawdon'.

Page 1/1 | 1 

  • Incrementing through mysql PHP

    - by Rawdon
    I am looking at try to increment and decrement by three records through a table and present those records. Say if the id '4' is currently active. I want the to be display the ID's and category of 3.2.1 and 5.6.7 from an increment and decrement So far I have: $stmt = $db->query("SELECT id, category FROM test"); $stmt->execute(); while ($results = $stmt->fetch(PDO::FETCH_ASSOC)) { $current = $results['id']; $category = $results['category']; $next = array(array('slide_no' => $current, 'category' => $category)); } print_r($next); Now with this, I am getting back every row in the table. I'm now getting confused on how I could increment and decrement the records by 3 and make sure that the category will also increment correctly. Thank you very much.

    Read the article

1