Advertisement
Guest User

Untitled

a guest
Sep 19th, 2017
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.63 KB | None | 0 0
  1. <?php
  2. if( !stripslashes($_POST['term']) ){ return; }
  3. include ("data.php");
  4. $link = mysql_connect($hostitel, $user, $pass);
  5. $dbsel = mysql_select_db($databaze, $link);
  6.  
  7. mysql_query("SET NAMES UTF8");  
  8.  
  9.  
  10.     if (($_POST['func'])==1):
  11.         $query = "SELECT * FROM slovnik where english_term LIKE '%".stripslashes($_POST['term'])."%'";
  12.         else:
  13.         $query = "SELECT * FROM slovnik where czech_term LIKE '%".stripslashes($_POST['term'])."%'";
  14.     endif;
  15.  
  16. $result = mysql_query($query);
  17. if (!$result) {
  18.     $message  = 'Invalid query: ' . mysql_error() . "\n";
  19.     $message .= 'Whole query: ' . $query;
  20.     die($message);
  21. }
  22. if( mysql_num_rows( $result ) == 0 ){
  23.             print '<b>Nic nebylo nalezeno.</b>';  
  24.             return;
  25.         }
  26. $xx = 0;
  27. echo "<br />";
  28. echo "<TABLE border='1' cellspacing='1' cellpadding='2' style='border-collapse: collapse;background-color: #FFFFDD; '>";
  29. echo "<TR>";
  30.     echo "<TH width='50px'>".'zkratka'."</TH>";
  31.     echo "<TH width='200px'><strong>".'anglicky'."</strong></TH>";
  32.     echo "<TH width='300px'><strong>".'česky'."</strong></TH>";
  33.     echo "<TH width='350px'><strong>".'výklad'."</strong></TH>";
  34.     echo "</TR>";
  35. while ($row = mysql_fetch_assoc($result)) {
  36. if ($xx % 2):
  37.     $color='#ffffff';
  38.   else:
  39.     $color='dddddd';
  40.   endif;
  41.     echo "<TR>";
  42.     echo "<TD width='50px' bgcolor=$color>".$row['zkratka']."</TD>";
  43.     echo "<TD width='200px' bgcolor=$color>".$row['english_term']."</TD>";
  44.     echo "<TD width='300px' bgcolor=$color>".$row['czech_term']."</TD>";
  45.     echo "<TD width='350px' bgcolor=$color>".$row['pouziti']."</TD>";
  46.     echo "</TR>";
  47. $xx++;
  48.     }
  49.  
  50. echo "</TABLE>";
  51. mysql_free_result($result);
  52. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement