$sql = "SELECT COUNT(*) FROM $tabela"; $result = mysql_query($sql) OR die('Queryproblem: ' . mysql_error()); $ilePozycji = mysql_result($result, 0); mysql_free_result($result); $sql = "SELECT * FROM $tabela LIMIT $from, $ileNaStronie"; $result = mysql_query($sql) OR die('Queryproblem: '.mysql_error()); $zlicz = mysql_num_rows($result); $sql1 = "SELECT $tabela.id_book, $tabela.imie_nazwisko, $tabela.start_pol, $tabela1.animals, $tabela1.animals1, $tabela1.animals2, $tabela1.ilosc, $tabela1.ilosc1, $tabela1.ilosc2, $tabela1.ilosc_shot, $tabela1.login FROM $tabela LEFT JOIN shot ON $tabela.id_book=$tabela1.id_book WHERE $tabela.id_book>$from"; $result1 = mysql_query($sql1) OR die('Queryproblem: '.mysql_error());
wszytsko ładnie działa, jednak potrzebuję użyć warunku w zapytaniach filtrując dane w tabeli $tabela po kolumnie nr_obw więc zrobiłem:
$sql = "SELECT COUNT(*) FROM $tabela WHERE nr_obw='{$_SESSION['nr_obw']}'"; $result = mysql_query($sql) OR die('Queryproblem: ' . mysql_error()); $ilePozycji = mysql_result($result, 0); mysql_free_result($result); $sql = "SELECT * FROM $tabela WHERE nr_obw='{$_SESSION['nr_obw']}' LIMIT $from, $ileNaStronie"; $result = mysql_query($sql) OR die('Queryproblem: '.mysql_error()); $zlicz = mysql_num_rows($result); $sql1 = "SELECT $tabela.id_book, $tabela.imie_nazwisko, $tabela.start_pol, $tabela1.animals, $tabela1.animals1, $tabela1.animals2, $tabela1.ilosc, $tabela1.ilosc1, $tabela1.ilosc2, $tabela1.ilosc_shot, $tabela1.login FROM $tabela LEFT JOIN shot ON $tabela.id_book=$tabela1.id_book WHERE $tabela.nr_obw='{$_SESSION['nr_obw']}' and $tabela.id_book>$from"; $result1 = mysql_query($sql1) OR die('Queryproblem: '.mysql_error());
i po takiej operacji w łeb wzięło prawidłowe stronicowanie, rekordy dodają się nie tam gdzie powinny
proszę o radę bo już oczy wypatrzyłem i nic nie mogę znaleźć.
P.s. jeśli stronicowanie mieści się na jednej stronie to jest ok