Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [SQL]Złe wartości w łączeniu rekordów 2 tabel
eurosoft
post 3.12.2010, 20:46:55
Post #1





Grupa: Zarejestrowani
Postów: 179
Pomógł: 0
Dołączył: 5.11.2010

Ostrzeżenie: (0%)
-----


Proszę o pomoc w kodzie, po dodaniu warunku WHERE $tabela.nr_obw='{$_SESSION['nr_obw']}' rekordy się mieszają

  1. $sql = "SELECT COUNT(*) FROM $tabela WHERE nr_obw='{$_SESSION['nr_obw']}'";
  2. $result = mysql_query($sql) OR die('Queryproblem: ' . mysql_error());
  3. $ilePozycji = mysql_result($result, 0);
  4. mysql_free_result($result);
  5.  
  6. $sql = "SELECT * FROM $tabela WHERE nr_obw='{$_SESSION['nr_obw']}' LIMIT $from, $ileNaStronie";
  7. $result = mysql_query($sql) OR die('Queryproblem: '.mysql_error());
  8. $zlicz = mysql_num_rows($result);
  9.  
  10. $sql1 = "SELECT
  11. $tabela.id_book,
  12. $tabela.imie_nazwisko,
  13. $tabela.start_pol,
  14. $tabela1.animals,
  15. $tabela1.animals1,
  16. $tabela1.animals2,
  17. $tabela1.ilosc,
  18. $tabela1.ilosc1,
  19. $tabela1.ilosc2,
  20. $tabela1.ilosc_shot,
  21. $tabela1.login
  22. FROM $tabela LEFT JOIN shot ON $tabela.id_book=$tabela1.id_book WHERE $tabela.nr_obw='{$_SESSION['nr_obw']}' and $tabela.id_book>$from";
  23. $result1 = mysql_query($sql1) OR die('Queryproblem: '.mysql_error());
  24.  
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Wersja Lo-Fi Aktualny czas: 14.08.2025 - 00:56