Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if( !stripslashes($_POST['term']) ){ return; }
- include ("data.php");
- $link = mysql_connect($hostitel, $user, $pass);
- $dbsel = mysql_select_db($databaze, $link);
- mysql_query("SET NAMES UTF8");
- if (($_POST['func'])==1):
- $query = "SELECT * FROM slovnik where english_term LIKE '%".stripslashes($_POST['term'])."%'";
- else:
- $query = "SELECT * FROM slovnik where czech_term LIKE '%".stripslashes($_POST['term'])."%'";
- endif;
- $result = mysql_query($query);
- if (!$result) {
- $message = 'Invalid query: ' . mysql_error() . "\n";
- $message .= 'Whole query: ' . $query;
- die($message);
- }
- if( mysql_num_rows( $result ) == 0 ){
- print '<b>Nic nebylo nalezeno.</b>';
- return;
- }
- $xx = 0;
- echo "<br />";
- echo "<TABLE border='1' cellspacing='1' cellpadding='2' style='border-collapse: collapse;background-color: #FFFFDD; '>";
- echo "<TR>";
- echo "<TH width='50px'>".'zkratka'."</TH>";
- echo "<TH width='200px'><strong>".'anglicky'."</strong></TH>";
- echo "<TH width='300px'><strong>".'česky'."</strong></TH>";
- echo "<TH width='350px'><strong>".'výklad'."</strong></TH>";
- echo "</TR>";
- while ($row = mysql_fetch_assoc($result)) {
- if ($xx % 2):
- $color='#ffffff';
- else:
- $color='dddddd';
- endif;
- echo "<TR>";
- echo "<TD width='50px' bgcolor=$color>".$row['zkratka']."</TD>";
- echo "<TD width='200px' bgcolor=$color>".$row['english_term']."</TD>";
- echo "<TD width='300px' bgcolor=$color>".$row['czech_term']."</TD>";
- echo "<TD width='350px' bgcolor=$color>".$row['pouziti']."</TD>";
- echo "</TR>";
- $xx++;
- }
- echo "</TABLE>";
- mysql_free_result($result);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement