Having some trouble in my pagation code(PHP)
<p>My table is posting and in that table, it shows all the posting people put in. 
I am trying to make page navigation links at the bottom of the posts. 
the function generateenter code here_page_links does all the work.</p>

<p>The code seem to be only showing the "&lt;-" and "->" and not the link numbers. I think the function is only reading the $_GET['posting'] ==1.</p>

<p>(this code is from the Oreilly PHP/MySQL book. I am using it as practice)</p>

<pre><code>function generate_page_links($cur_page, $num_pages) {
    $page_links = '';

    // If this page is not the first page, generate the "previous" link
    if ($cur_page &gt; 1) { //cur_page is just a number that is gotten from the url.
      $page_links .= '&lt;a href="' . $_SERVER['PHP_SELF'] . '?page=' . ($cur_page - 1) . '"&gt;&lt;--&lt;/a&gt; ';
    }
    else {
      $page_links .= '&lt;- ';
    }

    // Loop through the pages generating the page number links
    for ($i = 1; $i &lt;= $num_pages; $i++) {
      if ($cur_page == $i) {
        $page_links .= ' ' . $i;
      }
      else {
         $page_links .= ' &lt;a href="' . $_SERVER['PHP_SELF'] . '?page=' . $i . '"&gt; ' . $i . '&lt;/a&gt;';
      }
    }

    // If this page is not the last page, generate the "next" link
    if ($cur_page &lt; $num_pages) {
      $page_links .= ' &lt;a href="' . $_SERVER['PHP_SELF'] . '?page=' . ($cur_page + 1) . '"&gt;-&gt;&lt;/a&gt;';
    }
    if ($cur_page == $num_pages){ //the last page
      $page_links .= ' -&gt;';
    }

    return $page_links; //need to return this variable in the function
  }

  // Calculate pagination information
  $cur_page = isset($_GET['page']) ? $_GET['page'] : 1;
  $results_per_page = 3;  // number of results per page
  $skip = (($cur_page - 1) * $results_per_page);


  $query = "SELECT * FROM posting ORDER BY date_added DESC";
  $data = mysqli_query($dbc, $query);
  $total = mysqli_num_rows($data);
  $num_pages = ceil($total / $results_per_page);

  //Query again to get just the subset of results
  $query =  $query . " LIMIT $skip, $results_per_page";
  $result = mysqli_query($dbc, $query);
  echo '&lt;table&gt;';
    echo '&lt;tr&gt;&lt;td&gt;&lt;b&gt;Title&lt;/b&gt;&lt;/td&gt;&lt;td&gt;&lt;b&gt;Date Posted&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;';
  while ($row = mysqli_fetch_array($result)) {
      echo '&lt;tr&gt;&lt;td&gt;&lt;a href="ad.php? 

    posting_id='.$row['posting_id'].'

    "&gt;'.$row['title'].'&lt;/a&gt;&lt;/td&gt;';
    echo '&lt;td&gt;'.$row['date_added'].'&lt;/td&gt;';
    //echo '&lt;td&gt;'.$row['name'].'&lt;/td&gt;&lt;/tr&gt;';
  }
 echo '&lt;/table&gt;';

  // Generate navigational page links if we have more than one page
  if ($num_pages &gt; 1) {
    echo generate_page_links($user_search, $sort, $cur_page, $num_pages);
  }
</code></pre>
