Har lige prøvet på en anden måde:
- <?php
-
-
- function projectLinksNextPrev($project_id) {
- //Connect to db
- $link = mysql_connect("","","");
- mysql_select_db("", $link);
-
- //Create variables for previous and next links
- $prev_id = $id - 1;
- $next_id = $id + 1;
-
- //call db to find out if previous project_id exists
- $result = mysql_query("SELECT * FROM `cases` WHERE `id`=$prev_id", $link);
- $num_rows_prev = mysql_num_rows($result);
- //call db to find out if next project_id exists
- $result = mysql_query("SELECT * FROM `cases` WHERE `id`=$next_id", $link);
- $num_rows_next = mysql_num_rows($result);
- $output = '';
- if($num_rows_prev != 0) {
- $output .= '<li class="prev"><a href="./?id='.$prev_id.'"><img src="../../img/main/32px/arrow-left2.png" width="32" height="32" alt="Forrige">Forrige</a></li>';
- }
- if($num_rows_next != 0) {
- $output .= '<li class="icon-case"><a href="../"><img src="../../img/main/32px/stack.png" width="32" height="32" alt="Oversigt"></a></li>
- <li class="next"><a href="./?id='.$next_id.'">Næste<img src="../../img/main/32px/arrow-right2.png" width="32" height="32" alt="Næste"></a></li>';
- }
- return $output;
- }
-
-
- ?>
- <?php print projectLinksNextPrev($_GET['project_id']); ?>
Det bliver vist på siden nu det hele.
- Men linket i knappen, er det samme, som sidens id er.
Så kan ikke trykke videre.
Indlæg senest redigeret d. 17.04.2014 15:39 af Bruger #16906