Witam,

Jak w temacie mam problem z wyswietlaniem sie stron. Sprawa wyglada nastepujaco:

1. Stworzylem strone w HTML oparta o DIV-y
2. Na stronie utworzylem galerie zdjec napisana w PHP i przechowywana w bazie MySql
3. Wszystko smiga na domowym serwerze (krasnal)

Problem pojawil sie po przeslaniu na serwer (ovh.org) wszystko bylo by dobrze gdyby nie to ze nie moge przelaczyc kolejnej strony w mojej galerii. Link sie zmienia w adresie a zdjecia caly czas pokazuje z pierwszej strony. Przegladalem rozne fora troche poczytalem ale nie moge sobie z tym poradzic, mysle ze bedzie to problem z funkcja _GET ale nawet gdyby to byla prawda nie wiem jak sie zabrac za to. Moze jest cos innego zupelnie banalnego. Prosze o zerkniecie na moj kod zdrodlowy, w razie jakis sugestii prosze o odpowiedz.

plik galerii .php
  1. <?php
  2. mysql_connect("localhost","xxx","xxx");
  3. mysql_select_db("gallery");
  4.  
  5. if (!isset($first)) { $first = 0; } 
  6. $ltmp = 6; 
  7.  
  8. $zap = mysql_query("SELECT * FROM image WHERE category='contest' LIMIT $first,$ltmp;"); 
  9. while ($wynik = mysql_fetch_assoc($zap)) { 
  10.  
  11. echo'<div class=zdj><div class=opis>'.$wynik['image'].'</div><a href="gallery/'.$wynik['address'].'" rel="lightbox[roadtrip]"><img src="gallery/'.$wynik['address_mini'].'" border=0 height=100 width=150/></a><br><div class=comment><a href=index.php?go=20&id='.$wynik['id'].'>- Add a comment -</a></div></div>';
  12. }
  13.  
  14. echo'<div class=navigation>';
  15. $count = mysql_num_rows(mysql_query("SELECT address FROM image WHERE category='contest';")); 
  16.  
  17. $count = $count/$ltmp; 
  18. $ile = ceil($count); 
  19.  
  20. if ($first!=0) print("<a href="index.php?go=15&first=" . ($first-$ltmp) . "" title="Poprzednie"><big>Ť</big></a>"); 
  21.  
  22. for ($i=1;$i<=$ile;$i++) 
  23. { 
  24.  
  25.  print("<a href="index.php?go=15&first=" . ($i*$ltmp-$ltmp) . "" title="" . ($i*$ltmp-($ltmp-1)) . "-" . ($i*$ltmp) ."">");
  26.  
  27.  if ($first==($i*$ltmp-$ltmp)) 
  28.  { 
  29.  print ("<b>|" . $i . "|</b></a> "); $akt=$i; } else { print ("|" . $i . "|</a> "); 
  30.  } 
  31. } 
  32.  
  33. if ($akt<$ile) print ("<a href="index.php?go=15&first=" . ($first+$ltmp) . "" title="Następne"><big>ť</big></a>");
  34. echo'</div>';
  35. ?>


plik index.php

  1. <p>
  2. <? 
  3. switch ($_GET['go']) 
  4. { 
  5.  case 1: 
  6. include("index.php");
  7. break;
  8. case 2:
  9. include("about.html");
  10. break;
  11. case 3:
  12. include("schools.php");
  13. break;
  14. case 4:
  15. include("experience.php");
  16. break;
  17. case 5:
  18. include("contact.html");
  19. break;
  20. case 6:
  21. include("boc.html");
  22. break;
  23. case 7:
  24. include ("usa.html");
  25. break;
  26. case 8:
  27. include("hrit.html");
  28. break;
  29. case 9:
  30. include ("hrel.html");
  31. break;
  32. case 10:
  33. include ("ae.html");
  34. break;
  35. case 11:
  36. include ("wwszip.html");
  37. break;
  38. case 12:
  39. include ("hs.html");
  40. break;
  41. case 13:
  42. include ("ps.html");
  43. break;
  44. case 14:
  45. include ("gallery.php");
  46. break;
  47.  case 15:
  48. include ("photoshopcontest.php");
  49. break;
  50. case 16:
  51. include ("photoshop.php");
  52. break;
  53. case 17:
  54. include ("present.php");
  55. break;
  56. case 18:
  57. include ("homeland.html");
  58. break;
  59. case 19:
  60. include ("usaimg.html");
  61. break;
  62. case 20:
  63. include ("comment.php");
  64. break;
  65. case 21:
  66. include ("teva.php");
  67. break;
  68.  case 0: 
  69.  default: 
  70. include("start.php");
  71. } 
  72. ?>


Zastanawiam sie tez czy w pliku index.php funkcja switch jest poprawana czy nie musze czegos dodac do niej. Zeby nie przeciagac tego tematu dodalem tylko kod php mam nadzieje ze to wystarczy zeby znalezc problem.

Z gory dzieki i pozdrowionka smile.gif

Problem rozwiazny dzieki uprzejmosci Shavei oraz nospor.

Nalezalo zmienic
  1. <?php
  2. if (!isset($first)) { $first = 0; }
  3. ?>


na
  1. <? 
  2. if (!isset($_GET['first'])) $first = 0;
  3. else $first = (int) $_GET['first']; 
  4. ?>


Pozdrawiam