Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $server='mysql.cba.pl';
- $username='tfrymus';
- $password='Mpkfa1234';
- $pol=mysql_connect($server, $username, $password);
- if($pol)
- {
- echo "POLACZONO Z BAZA DANYCH ";
- $baza=mysql_select_db('tfrymus');
- if($baza)
- {
- $zap=mysql_query("SELECT * FROM dane");
- if($zap)
- {
- $query = "SELECT * FROM dane";
- $szukaj = $_GET['kryteria'];
- $where = " nazwisko LIKE '%$szukaj%'";
- if (!empty($where))
- $query = $query . " WHERE $where";
- $zapytanie = "SELECT COUNT(*) FROM dane WHERE $where";
- $pomoc=mysql_query ($zapytanie);
- $liczba_wyn=mysql_result($pomoc, 0);
- echo $liczba_wyn;
- echo " - plik wyniki.php";
- $liczba_na_str=10;
- $liczba_str=$liczba_wyn/$liczba_na_str;
- $liczba_str=ceil($liczba_str);
- if (isset($_GET['str']))
- $str=$_GET['str'];
- else $str=1;
- $pomin=($str-1)*$liczba_na_str;
- $zapytanie= "SELECT * FROM dane WHERE $where LIMIT $pomin, $liczba_na_str";
- $wyniki=mysql_query($zapytanie);
- echo'<table><tr><th>ImiÄ™</th><th>Nazwisko</th><th>plec</th><th>nazwisko panienskie</th><th>email</th><th>kod</th></tr>';
- while($row=mysql_fetch_array($wyniki))
- {
- echo "<tr><td>{$row['imie']}</td><td>{$row['nazwisko']}</td><td>{$row['plec']}</td><td>{$row['naz_pan']}</td><td>{$row['email']}</td><td>{$row['kod']}</td></tr>";
- }
- echo'</table>';
- $linki=' ';
- if ($str>1)
- {
- $linki=$linki. '<a href="'.$_SERVER['PHP_SELF']. '?strona=4&szukaj=&str='.($str-1).'"><-</a>';
- }
- else
- {
- $linki=$linki. '<-';
- }
- for($i=1; $i<=$liczba_str; $i++)
- {
- if ($str==$i)
- {
- $linki=$linki.' '.$i;
- }
- else
- {
- $linki=$linki. '<a href="'.$_SERVER['PHP_SELF']. '?strona=4&szukaj=&str='.$i.'">'.$i.'</a>';
- }
- }
- if ($str<$liczba_str)
- {
- $linki=$linki. '<a href="'.$_SERVER['PHP_SELF']. '?strona=4&szukaj=&str=2'.($str+1).'">-></a>';
- }
- else
- {
- $linki=$linki. '->';
- }
- echo $linki;
- }
- else
- echo " nie weszlo w zap".mysql_error();
- }
- else
- echo"cos nie tak";
- }
- else
- echo "NIE POLACZONO Z BAZA DANYCH";
- mysql_close();
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement